C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-28-2009, 05:04 AM   #1
Registered User
 
Join Date: Aug 2009
Posts: 11
Thumbs up Joining consecutive lines

Hi *,

Can anyone tell me if there is an unix utility to join two consecutive lines ?

ex:

$ cat file
a
1
b
2
c
3

output should be :
a 1
b 2
c 3

Thanks,
14341
14341 is offline   Reply With Quote
Old 10-28-2009, 05:32 AM   #2
Registered User
 
Join Date: Oct 2009
Location: While(1)
Posts: 316
use editor like vim or emacs (i use this) can't think of any direct utility from shell
RockyMarrone is offline   Reply With Quote
Old 10-28-2009, 05:50 AM   #3
Registered User
 
Join Date: Aug 2009
Posts: 11
Quote:
Originally Posted by RockyMarrone View Post
use editor like vim or emacs (i use this) can't think of any direct utility from shell
kidding uh!

Dude i don't want to do it manually.

As a work around a c/cpp program can be written which can do the job. But i just want to know if i can achieve this with inbuilt unix tools or not.

Thanks,
14341
14341 is offline   Reply With Quote
Old 10-28-2009, 05:56 AM   #4
Registered User
 
Join Date: Aug 2009
Posts: 11
Is there any possibility to solve the above problem using awk?
14341 is offline   Reply With Quote
Reply

Tags
linux, shell, unix

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing "shapes" based on character lines and number of line inputs matt_570 C++ Programming 11 10-07-2008 06:19 PM
Print out first N lines YoYayYo C Programming 1 02-21-2008 12:58 AM
First Consecutive composites Help ch4 C Programming 10 11-23-2007 04:55 PM
Line Counting 00Sven C Programming 26 04-02-2006 08:59 PM
display 10 consecutive lines........... imbecile in C C Programming 6 07-09-2003 07:37 PM


All times are GMT -6. The time now is 08:47 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22