![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX Desktop for Dummies Questions & Answers Discuss UNIX and Linux user interfaces like GNOME, KDE, CDE, and Open Office here. All UNIX and Linux Newbies Welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| search a word and delete consecutive lines below it | vikas027 | Shell Programming and Scripting | 3 | 06-03-2009 02:02 AM |
| need help cutting consecutive lines with sed or awk | raghin | Shell Programming and Scripting | 2 | 06-04-2008 04:59 AM |
| grab next consecutive line or lines | wisher115 | Shell Programming and Scripting | 1 | 12-07-2006 08:01 AM |
| Appending Consecutive lines | pondlife | Shell Programming and Scripting | 8 | 08-13-2004 05:36 AM |
| Cutting n consecutive lines from a file... | Vishnu | UNIX for Dummies Questions & Answers | 2 | 10-18-2002 10:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I have a few lines like --
feature 1, subfeat 0, type 3, subtype 1, value 0, -- feature 1, subfeat 0, type 1, subtype 1, value 0, I would like to concatenate the consecutive four lines so that the output is -- feature 1,subfeat 0,type 3,subtype 1,value 0, feature 1,subfeat 0,type 1,subtype 1,value 0, Can anyone suggest a way to do that? |
|
||||
|
Try this:
Code:
awk 'NR > 1 && /feature/{print ""}
/--/{next}
{printf $0}
END{print ""}' file
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|