![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell script problems to do | cleansing_flame | Shell Programming and Scripting | 0 | 11-27-2007 09:19 AM |
| Problems with an if/then loop within a script | lodey | Shell Programming and Scripting | 3 | 09-18-2007 03:45 AM |
| Stock script problems | hinch | UNIX for Dummies Questions & Answers | 1 | 05-24-2006 03:48 AM |
| Problems with Perl/KSH Web Log Script | mmanders | Shell Programming and Scripting | 3 | 05-03-2006 07:32 AM |
| having ksh script problems | jerzey4life | UNIX for Dummies Questions & Answers | 4 | 09-22-2001 05:39 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
script problems
Hi,
Here is an example of a problem I have: File2: contain the following lines: a^ aaa^aa aa^~ b^ bbb^bb bb^~ c^ ccc^cc cc^~ d^ dddd^dd dd^~ File1: contain the following lines: b^ bbb^bb bb^~ c^ ccc^cc cc^~ I get File2 as input and I want to do as following: for each line in file2 { if (line exist in file1) print "! "line >> output else print "+ "line >> output } I work on tcsh script: and this is what I wrote: cat File2 | awk -F"^" '{if (grep -c $0 file1 == 0) print "- "$0 >> output else print "! "$0 >> output}' Expected output: - a^ aaa^aa aa^~ ! b^ bbb^bb bb^~ ! c^ ccc^cc cc^~ - d^ dddd^dd dd^~ But I get: ! a^ aaa^aa aa^~ ! b^ bbb^bb bb^~ ! c^ ccc^cc cc^~ ! d^ dddd^dd dd^~ Any idea? Thanks, Bando. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|