![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extracting data from text file based on configuration set in config file | suparnbector | Shell Programming and Scripting | 3 | 08-09-2007 11:25 PM |
| Exporting text file data to csv | l_jayakumar | Shell Programming and Scripting | 3 | 09-18-2005 08:27 PM |
| filter data | deep.singh | UNIX for Dummies Questions & Answers | 3 | 08-14-2005 08:24 PM |
| How to extract data from a text file | negixx | Shell Programming and Scripting | 1 | 07-19-2005 06:30 PM |
| getting data out from a text file | skotapal | Shell Programming and Scripting | 7 | 09-14-2002 08:10 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#15
|
||||
|
||||
|
Strange,
it seems that you're running this: Code:
awk 'END { if (f) print x } $0 ~ v && f++ /^--/ { if (f) print x; x = f = 0 }
{ x = x ? x RS $0 : $0 }' v="^IP=172.18.0.1$" file
Code:
awk 'END { if (f) print x } $0 ~ v && f++
/^--/ { if (f) print x; x = f = 0 }
{ x = x ? x RS $0 : $0 }' v="^IP=172.18.0.1$" file
Anyway, try separating the statments explicitly: Code:
awk 'END { if (f) print x } $0 ~ v && f++;
/^--/ { if (f) print x; x = f = 0 }
{ x = x ? x RS $0 : $0 }' v="^IP=172.18.0.1$" file
|
| Forum Sponsor | ||
|
|
|
#16
|
|||
|
|||
|
How I run that awk script in Solaris unix shell? (Couple of lines, error comes if I run it on one line).
Last edited by Hone1975; 04-16-2008 at 06:23 AM. |
|
#17
|
||||
|
||||
|
Quote:
could you post the command and the errors (just copy/paste them from your terminal)? |
|
#18
|
|||
|
|||
|
awk 'END { if (f) print x } $0 ~ v && f++; /^--/ { if (f) print x; x = f = 0 } { x = x ? x RS $0 : $0 }' v="^IP=172.18.0.1$" list.txt
Illegal variable name. |
|
#19
|
||||
|
||||
|
Quote:
Try this also: 1. Put this code into a file (for example Hone1975.awk) preserving the format: Code:
END { if (f) print x }
$0 ~ v && f++
/^--/ { if (f) print x; x = f = 0 }
{ x = x ? x RS $0 : $0 }
Code:
nawk -f Hone1975.awk v="^IP=172.18.0.1$" list.txt |
||||
| Google The UNIX and Linux Forums |