![]() |
|
|
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 |
| Row to Columns question | bleach8578 | Shell Programming and Scripting | 6 | 04-01-2009 08:39 AM |
| How to remove columns with specific string? | AMBER | UNIX for Dummies Questions & Answers | 2 | 03-31-2009 03:18 PM |
| Perl, printing a string into columns | doubleminus | UNIX for Dummies Questions & Answers | 5 | 05-21-2008 10:41 PM |
| Append string to columns from 2 files | karthikn7974 | Shell Programming and Scripting | 3 | 04-28-2008 10:32 AM |
| Need help in AWK;Search String and rearrange columns | spring_buck | Shell Programming and Scripting | 2 | 04-05-2007 12:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Quote:
Code:
/.log/ && P { print "" } # if the last line had ".log" in it (P > 0) print a blank line
/.log/ { P=1 } # indicate we have a line with ".log" in it, the above line will evaluate to true if the next line has a ".log" in it
Code:
/^HF/ { printf $2 " "; getline; print $2; P=0 }
If a line starts with HF get the next line and print both together, reset P to say this line doesn't have ".log" in it. The HF= part is removed by using = as the field separator (-F=) Or something like that! I wouldn't really describe it as powerful. ---------- Post updated at 02:28 PM ---------- Previous update was at 01:47 PM ---------- Quote:
I should have used a less ambiguous variable name than P (which does look like p)! (instead of editing your previous posts, it helps if you reply to the thread. that way I can see your updates more easily - I'm notified that way) |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|