Today's Posts

Post questions about C, C++, Java, SQL, and other programming languages here.

Concatenate two lines in a fIle


Login to Reply

Thread Tools Search this Thread
# 1  
Old 09-21-2011
Error Concatenate two lines in a fIle

Hi All,

Can any one help me in finding the solution for concatenating two or more lines in a file and writing them to a temporary file.

for Example:
He is a wise student.
So he got first rank.

This is in a file i want the output as
He is a wise student so he got first rank. into a file

Please help me Thanks in advance.
# 2  
Old 09-21-2011


Try this code,

awk '{ORS="";print;}' File

# 3  
Old 09-21-2011
$ paste - - < infile

# 4  
Old 09-22-2011
can explain it briefly i didn't got the solution....
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Concatenate three lines into one FredAtArrow UNIX for Dummies Questions & Answers 7 08-14-2014 05:03 PM
Concatenate select lines from multiple files pathunkathunk Shell Programming and Scripting 3 04-13-2014 12:25 PM
How to concatenate lines with specific pattern? nixtime Shell Programming and Scripting 8 06-25-2013 06:39 PM
Concatenate lines with unique string AND number pioavi Shell Programming and Scripting 2 01-18-2012 07:43 AM
Concatenate lines in file shell script systemoper UNIX for Advanced & Expert Users 3 01-14-2012 06:40 PM
Need to concatenate spuriously separated lines lemele Shell Programming and Scripting 16 12-28-2011 02:21 AM
Concatenate lines between lines starting with a specific pattern s052866 Shell Programming and Scripting 9 10-24-2010 01:09 PM
Concatenate multiple lines based. indrajit_u Shell Programming and Scripting 8 06-30-2010 06:50 PM
concatenate lines in pairs kerl Shell Programming and Scripting 5 06-17-2010 12:26 PM
Concatenate two lines in one Orbix Shell Programming and Scripting 5 04-29-2010 05:40 PM
concatenate lines using shell scripting dtdt Shell Programming and Scripting 13 09-07-2009 01:14 AM
concatenate log file lines up to timestamp AlanC Shell Programming and Scripting 4 06-29-2009 12:38 PM
Concatenate lines in a single paragraph cgkmal Shell Programming and Scripting 4 05-17-2009 02:02 AM
How to concatenate consecutive lines shivi707 UNIX Desktop Questions & Answers 1 01-12-2009 09:08 AM
concatenate and display 2 lines as 1 with a condition for 2 line ? vithala Shell Programming and Scripting 7 07-11-2008 02:01 AM

All times are GMT -4. The time now is 11:51 PM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.
Show Password