Solved

sed - join lines

Posted on 1997-03-06
1
1,646 Views
Last Modified: 2013-12-16
with cshell, how can I use sed to join two consecutive lines?
0
Comment
Question by:funcell
1 Comment
 
LVL 4

Accepted Solution

by:
jos010697 earned 50 total points
ID: 1811810
Use this as a sed script:

:join
/$/{N
s/\n//
}

It read two consecutive lines and joins them; the cycle
is repeated over and over again for the entire file. So,
if the gibberish above is saved in, say, script.sed,
the command

sed -f script.sed "filename"

joins all consecutive lines from that file.

kind regards,

Jos aka jos@and.nl
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sort command HPUX 11 75
Shell script errors 10 129
KSH What's the best way to pass multiple variables (some may be blank) to a function? 5 50
MarkLogic 1 79
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question