![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk, ignore first x number of lines. | trey85stang | Shell Programming and Scripting | 8 | 05-21-2008 05:44 AM |
| replace 2 identical strings on different lines | prkfriryce | Shell Programming and Scripting | 3 | 06-15-2007 12:18 PM |
| How can I ignore only the lines which have # at the begining? | csaha | Shell Programming and Scripting | 1 | 01-30-2006 03:35 AM |
| Ignore Lines Begining With # | sysera | Shell Programming and Scripting | 4 | 08-23-2005 10:04 AM |
| Make sed ignore lines | Scarlos | Shell Programming and Scripting | 2 | 07-21-2005 11:33 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Ignore identical lines
Hello Experts,
I have two files called "old" and "new". My old file contains 10 lines and my new file contains 10 + "n" lines. The first field in both these files contain ID. I sort these two files on ID. I am interested in only the lines that are in the new file and not in old. I tried the below but was not successful awk -F"\t" '{a[$] = $0} END { for (x in a) { print a[x] } }' maout > nodup I have attached a file which gives an example of how my input files look like and the output i expect Any suggestions would be appreciated. Many Thanks in advance. |
|
||||
|
Hello Franklin,
Many thanks for your reply. I tried both awk and grep commands but get syntax errors. For the grep command the error is >grep -v -f old new grep: illegal option --f For the awk command this is what i get >awk 'NR==FNR{a[$0];next}!($0 in a)' old new awk: syntax error near line 1 awk: bailing out near line could you let me know where i am going wrong please. Thanks again |
|
||||
|
Quote:
Quote:
Regards |
![]() |
| Bookmarks |
| Tags |
| nawk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|