10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
In the tab delimited files below I am trying to match $2 in file1 to $2 of file2. If a match is found the awk checks $3 of file2 and if it is greater than 40% and $4 of file2 is greater than 49, the line in file1 is printed. In the desired output line3 of file1 is not printed because $3 off file2... (9 Replies)
Discussion started by: cmccabe
9 Replies
2. Shell Programming and Scripting
Hi!
I want to delete N (say 10) lines after the line which text is found in a file "A".Also to delete the line in which the text is found.
Only one occurrence of the search string in the file "A"
The text to be deleted is in another text file "B". All the search texts in the file "B" are in... (3 Replies)
Discussion started by: shahid1632
3 Replies
3. UNIX for Dummies Questions & Answers
I want to print only the lines in file2 that match file1, in the same order as they appear in file 1
file1
file2
desired output:
I'm getting the lines to match
awk 'FNR==NR {a++}; FNR!=NR && a' file1 file2
but they are in sorted order, which is not what I want:
Can anyone... (4 Replies)
Discussion started by: pathunkathunk
4 Replies
4. Shell Programming and Scripting
hey guys,
I tried searching but most 'search and replace' questions are related to one liners.
Say I have a file to be replaced that has the following:
$ cat testing.txt
TESTING
AAA
BBB
CCC
DDD
EEE
FFF
GGG
HHH
ENDTESTING
This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies
5. UNIX for Dummies Questions & Answers
I have a diff command that does what I want but when comparing large text/log files, it uses up all the memory I have (sometimes over 8gig of memory)
diff file1.txt file2.txt | grep '^<'| awk '{$1="";print $0}' | sed 's/^ *//'
Is there a better more efficient way to find the lines in one file... (5 Replies)
Discussion started by: raptor25
5 Replies
6. UNIX for Dummies Questions & Answers
Hello all,
I'm using the Bash shell on Solaris 8.
Please can someone tell me how I can delete multiple lines in the hosts file?
I have a list of hosts that I want to quickly delete in the hosts file, but I'm looking for a quicker way than using VI to delete the lines one by one.
Regards,... (4 Replies)
Discussion started by: wthomas
4 Replies
7. Shell Programming and Scripting
I have sql's in a file separated by ";", need to put the sql in one single line till i find a ";" The input file is like this
SELECT s.sid,
s.serial#,
p.spid as "OS PID",
s.username,
s.module,
... (6 Replies)
Discussion started by: ilugopal
6 Replies
8. Shell Programming and Scripting
Hi,
I have 10 different strings. I have to delete the whole line matching with any one string.
I can use sed like below
sed '/$keyword1/d' fileList.txt > temp_fileList.txt
sed '/$keyword2/d' temp_fileList.txt > temp_fileList1.txt
.
.
.
Here is the problem i do not have fixed number... (9 Replies)
Discussion started by: shekhar_v4
9 Replies
9. Shell Programming and Scripting
I have a directory full of text data files.
Unfortunately I need to get rid of the 7th and 8th line from them all so that I can input them into a GIS application.
I've used an awk script to do one at a time but due to the sheer number of files I need some kind of loop mechanism to automate... (3 Replies)
Discussion started by: vrms
3 Replies
10. Shell Programming and Scripting
I am trying to use sed to delete multiple lines in a file. The problem is that I need to search for a certain line and then once found delete it plus the next 4 lines. For instance if I had a file that consisted of the following lines:
#Data1.start
(
(Database= data1)
(Name = IPC)... (1 Reply)
Discussion started by: rambo15
1 Replies