|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
hello i'm trying to figure out how to number a blank line. For instance this :
sed '/./=' file | sed '/./N; s/\n/ /' gives me 1 aaaa 2 bbbbbb 4 cccccc 5 ffkkkfff 6 ffsdfdfs I would like something like this: 1 aaaaa 2 3 bbbbbb 4 5 cccccc And so on... What would i have to do? I appreciate any help. Thanks. |
| Sponsored Links |
|
|
|
|||
|
Quote:
Is incremental really needed ? ![]() what about this, Code:
awk '{ printf "%d %s\n", NR, $0 }' filename
1 aaaa 2 eeee 3 4 bbbb 5 6 cccc |
|
|||
|
Thanks everyone.
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Blanks vs: Nulls | ebock | High Level Programming | 1 | 02-12-2008 05:16 PM |
| blanks in file name | LisaS | Shell Programming and Scripting | 1 | 10-06-2005 09:20 PM |
| blanks in an awk comand | collie | Shell Programming and Scripting | 1 | 08-25-2004 01:09 PM |
| Numbering | merlin | Shell Programming and Scripting | 3 | 06-07-2002 01:23 AM |
| Numbering! | biglemon | UNIX for Dummies Questions & Answers | 9 | 01-21-2002 03:58 AM |