![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem in filtering the file | adityam | UNIX for Dummies Questions & Answers | 0 | 11-22-2007 04:37 AM |
| Help, filtering some info. from a file under "()" | varungupta | UNIX for Advanced & Expert Users | 10 | 09-11-2007 03:59 AM |
| [Urgent]how to print the file names into a txt file??? | kumarsaravana_s | Shell Programming and Scripting | 15 | 03-12-2007 12:32 AM |
| Filtering multiple entries in a file | suman_jakkula | Shell Programming and Scripting | 2 | 08-22-2006 02:02 AM |
| filtering by file size | nir | UNIX for Dummies Questions & Answers | 2 | 01-17-2002 07:17 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Urgent: Filtering a File
Hi all
I need to write a small shell script, where we have one Log file and another File 1 containing some tags in it. My log file can have multiple tags in it which can be other than the ones that are part of File 1. So I need to write a script that will run and test whether the tags present in Log file are same as the ones that are in file 1 If there are some other tags in Log file other than file 1 then we need to make a file 2 containing all the new tags that are not present in File1. Please help me in writing this script as it is very urgent Regds, Hitesh |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
looked at comm?
See man pages of comm. See if it helps.
|
|
#3
|
|||
|
|||
|
Hey man can u please elaborate a bit more on it ...
i am new to this forum |
|
#4
|
|||
|
|||
|
example
Suppose file1 contains
1 2 3 4 5 6 7 and file2 contains 4 5 6 7 8 9 13 24 34 then comm -12 prints lines common to two files. comm -12 file1 file2 4 5 6 7 Check 'man comm'. Also remember comm works on sorted files. |
|
#5
|
|||
|
|||
|
Hi
thats so gr8 of u that u hv helped me by writing an example but now i hv understood that comm will give u the comm tags /numbers in the 2 files .... but if i look at this example itself what i need now is that i need to create a new file file 3 that will hv all the tags/ numbers that do not belong to file 2 but are part of file 1.... so my file 3 should be like 1 2 3 Please help me a bit on this ... thanx in advance |
|
#6
|
|||
|
|||
|
check man.
Check manual. Its all there. by the way, for your question -
comm -23 file1 file2 --> will give you lines in file1 and not in file2. You can redirect this output to a new file as required. comm -23 file1 file2 >file3 |
|||
| Google The UNIX and Linux Forums |