![]() |
|
|
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 |
| append a ' to the $1 $2 | ppass | Shell Programming and Scripting | 2 | 05-26-2008 10:59 AM |
| ftp append | brdholman | UNIX for Dummies Questions & Answers | 1 | 10-31-2007 10:02 AM |
| how to append into array thru awk | manas_ranjan | Shell Programming and Scripting | 2 | 09-21-2007 07:00 AM |
| append to fle using sed | shweta_d | Shell Programming and Scripting | 2 | 06-13-2007 03:57 AM |
| Append and redirect | Anna | UNIX for Dummies Questions & Answers | 1 | 07-06-2001 06:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Append using awk
Hi All, I have a problem with my awk script. I am trying to append the whole line to another file called " file.txt " but i can't. I suppose there's something wrong in the way that i pipe. I canot use " nawk -f awk_script input > file.txt " because i have a 2nd input. Can any expert give some advise? Input: wwwwww 0999 k= 1 0999 bb= 111 wwwwww ** QQQAAAR1 ccc ccc cc cc ccc 2007 wwwwww wwwwww 0001 k= 1 0001 bb= 222 wwwwww 0002 k= 1 0002 *bb= 333 ** abc ccc cc cc cc cc 2007 wwwwww 0001 k= 1 0001 bb= 444 wwwwww 0002 k= 1 0002 bb= 555 wwwwww wwwwww 0003 k= 1 0003 bb= 666 wwwwww ** QQQAAAR1 ccc ccc cc cc ccc 2007 wwwwww 0003 k= 1 0003 bb= 777 wwwwww 0004 k= 1 0004 *bb= 888 0005 k= 1 0005 bb= 999 Code:
FNR==NR && $1 == "**" && $2 ~ /^QQQ/ && $2 ~ /R1$/ && $8 == "2007" {
CODE = $2 ;print $0|getline > file.txt ; next};
|
|
||||
|
Quote:
But i don;t really understand this portion of the code " /^** QQQ[^ ]*R1 .* 2007$/ " . Can you help me understand it better ? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|