Sponsored Content
Top Forums Shell Programming and Scripting Compare two string in two separate file and delete some line of file Post 302743347 by saleh67 on Wednesday 12th of December 2012 02:43:41 PM
Old 12-12-2012
Compare two string in two separate file and delete some line of file

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
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare two .dat files and if there is any difference pulled into a separate file

Hi, compare two .dat files and difference will be moved into separate file.if anybody having code for this please send asap. using diff command, i don't know how to write shell programming. and my first file is like this including Header and trailer 10Ç20060323Ç01(Header) 01ÇIÇbabuÇ3000 01ÇIÇbaluÇ4000... (1 Reply)
Discussion started by: kirankumar
1 Replies

2. UNIX for Advanced & Expert Users

delete line from file if successful partial string found

Id like to delete a line from a file using (preferably a single line unix command) if it contains a certain string pattern. If line contains "abcdef" then delete that line. Help greatly appreciated. (7 Replies)
Discussion started by: cronjob78
7 Replies

3. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

4. Shell Programming and Scripting

Compare large file and identify difference in separate file

I have a very large system generated file containing around 500K rows size 100MB like following HOME|ALICE STREET|3||NEW LISTING HOME|NEWPORT STREET|1||NEW LISTING HOME|KING STREET|5||NEW LISTING HOME|WINSOME AVENUE|4||MODIFICATION CAR|TOYOTA|4||NEW LISTING CAR|FORD|4||NEW... (9 Replies)
Discussion started by: jubaier
9 Replies

5. Shell Programming and Scripting

delete the line with a particular string in a file using sed command.

Hello, I want to delete all lines with given string in file1 and the string val is dynamic. Can this be done using sed command. Sample: vars="test twinning yellow" for i in $vars do grep $i file1 if then echo "Do Nothing" else sed `/$i/d` file1 fi done Using the above... (5 Replies)
Discussion started by: PrasadAruna
5 Replies

6. UNIX for Dummies Questions & Answers

using sed delete a line from csv file based on specific data in two separate fields

Hello, :wall: I have a 12 column csv file. I wish to delete the entire line if column 7 = hello and column 12 = goodbye. I have tried everything that I can find in all of my ref books. I know this does not work /^*,*,*,*,*,*,"hello",*,*,*,*,"goodbye"/d Any ideas? Thanks Please... (2 Replies)
Discussion started by: Chris Eagleson
2 Replies

7. UNIX for Advanced & Expert Users

How to find a string in a line in UNIX file and delete that line and previous 3 lines ?

Hi , i have a file with data as below.This is same file. But actual file contains to many rows. i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ? Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies

8. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

9. Shell Programming and Scripting

Trying to use diff output to compare to a separate file

I have two files: smw:/working/iso_testing # cat a QConvergeConsoleCLI-1.1.03-49.x86_64.rpm aaa_base-13.2+git20140911.61c1681-1.3.i586.rpm acpica-20140724-2.1.2.i586.rpm test.rpm smw:/working/iso_testing # cat b QConvergeConsoleCLI-1.1.03-49.x86_64.rpm... (12 Replies)
Discussion started by: jedlund21
12 Replies

10. UNIX for Beginners Questions & Answers

Need help with how to search a file for a variable string and delete that line

Hi, I have a working script. It does what I am intending it to but a bit confused whether the sed part is supposed to be working or not. Further down is the script with the sed part that should have been working but not and the grep -v part which is the workaround that I am using at the... (10 Replies)
Discussion started by: newbie_01
10 Replies
RANDOMSOUND(8)						      System Manager's Manual						    RANDOMSOUND(8)

NAME
randomsound - ALSA sound card related entropy gathering daemon. SYNOPSIS
randomsound [options] DESCRIPTION
Using the low order bit of the ADC output of your sound card, randomsound gathers entropy, debiases it and offers it up to your kernel's random pool. It can be tweaked to only write into the pool when it drops below a certain level, and to back off once the pool is full enough. This build will set your sound card into 16 bit mono unsigned input at 8KHz. If your sound card cannot do that then you will need to change the defines in asoundrunner.c and recompile the package. You must have set up asound as root on your machine. This can be done with the asoundconf tool and its set-default-card command. You may also need to use the alsamixer to ensure that the sound card is generating plenty of noise. Set all the gains nice and high, turn on any boosters you have. If you have a V_REFLVL or similar then consider tweaking that. OPTIONS
-D Daemonize -v Increase verbosity. Can be used more than once. -m specify minimum number of bits of entropy in the pool. -M specify max number of bits in the pool. -b specify number of bytes of randomness to buffer for use. -d specify number of bytes to deposit into the pool each time. -h display help message -V display version information. AUTHOR
randomsound was written by Daniel Silverstone <dsilvers@digital-scurf.org> Pepperfish August 18, 2007 RANDOMSOUND(8)
All times are GMT -4. The time now is 10:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy