![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Conditionally joining lines in vi | ifermon | UNIX for Dummies Questions & Answers | 0 | 06-04-2008 06:43 AM |
| Joining lines from two files - please help | chandra004 | Shell Programming and Scripting | 25 | 07-26-2006 11:39 PM |
| Joining 2 lines in a file together | m223464 | Shell Programming and Scripting | 3 | 05-12-2005 08:42 AM |
| Joining multiple lines | beilstwh | Shell Programming and Scripting | 4 | 03-02-2005 02:51 AM |
| Joining lines in log file | bubba112557 | Shell Programming and Scripting | 3 | 05-18-2004 04:10 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
||||
|
||||
|
From man sed
Code:
n N Read/append the next line of input into the pattern space. |
| Forum Sponsor | ||
|
|
|
#9
|
||||
|
||||
|
Quote:
sed 'N;N;s/\n/ /' 4 lines? try: sed 'N;N;N;s/\n/ /' |
|
#10
|
||||
|
||||
|
Quote:
Code:
sed 'N;N;s/\n/ /g' |
|
#11
|
|||
|
|||
|
A bit late
paste -d"\t\t\n" <file_name>
|
|
#12
|
|||
|
|||
|
Thanks all
Hi all ...
Thanks a lot for all replies ... i got 4 solutions for to this ... and the sed one was simple .... I was new to n/N option in sed too .. thanks again to all .. |
|
#13
|
||||
|
||||
|
For future reference, the simplest way to join three lines is to use the paste command, like this...
Code:
paste -d ' ' - - - < file1 |
|
#14
|
|||
|
|||
|
Wow !!! I was surprised to see such a small command doing this ... well cal u give an idea as to how it works ?? what do this 3 hyphens stand for ??
|
|||
| Google The UNIX and Linux Forums |