![]() |
|
|
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 |
| Conditional merging of lines | sunny23 | Shell Programming and Scripting | 4 | 09-06-2008 12:31 PM |
| concat strings | melanie_pfefer | Shell Programming and Scripting | 1 | 12-04-2007 07:12 AM |
| concat string | mpang_ | Shell Programming and Scripting | 1 | 07-25-2006 07:03 AM |
| Concat | dhananjaysk | Shell Programming and Scripting | 1 | 03-20-2006 07:42 AM |
| Concat date | drukkie | UNIX for Dummies Questions & Answers | 2 | 05-30-2002 08:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Conditional concat lines awk
Hello,
I have a text file like this: NONE FILE_Rename frompath: /log_audit/AIX/log/current/AIXAFTPP.log NONE FILE_Unlink filename /audit/tempfile.14041142 NONE FILE_Rename NONE FILE_Rename filename /log_audit/AIX/log/last/S372008.log I would like to obtain a output text file using awk script: 1) If i have two lines like this i would like to concatenate in one. NONE FILE_Rename frompath: /log_audit/AIX/log/current/AIXAFTPP.log 2) If i have two lines like this i don't want to concatenate. NONE FILE_Rename NONE FILE_Rename Thanks a lot. |
|
||||
|
Quote:
![]() Regards |
|
|||||
|
Quote:
![]() Perl addition: if the file is not too big ![]() ![]() ![]() Code:
perl -p0e's/\n(?!(^NONE|\Z))/ /mg' file Last edited by radoulov; 10-15-2008 at 07:23 AM.. |
|
||||
|
sorry is not running
Also at the begin of the file i have a head text like:
host event login real process parent st ---------------- --------------- -------- -------- -------- -- I need to call the script like: script inputfile outputfile Thanks |
![]() |
| Bookmarks |
| Tags |
| concat lines awk conditional file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|