Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Compare two string in two seperat file and delete some line of file

$
0
0
Hi all
i want to write program with shell script that able compare two file content and if one of lines of file have # at the first of string or nothing find same string in one of two file . remove the line in second file that have not the string in first file. for example:

file 1:config-file.conf
{
</sound>
snd sound card
snd1 sound card
<sound>
}
if user put # at first of string and save it , like: # snd sound card in config file
the program goes to second file for example
blacklist-sound.conf
{
blacklist snd sound card
blacklist snd1 sound card
}
and delete line blacklist snd sound card

or if user delet snd sound card string in config file , and then save it.program can remove blacklist snd sound card line
in blacklist -sound.conf

sorry for bad English
than x

---------- Post updated at 02:43 PM ---------- Previous update was at 02:30 PM ----------

I should mention that both are required to be written in one shell script .means both
put # and remove string method work whit gather.
than x

Viewing all articles
Browse latest Browse all 16232

Trending Articles