The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Conditionally joining lines in vi ifermon UNIX for Dummies Questions & Answers 0 06-04-2008 10:43 AM
Joining lines from two files - please help chandra004 Shell Programming and Scripting 25 07-27-2006 03:39 AM
Joining 2 lines in a file together m223464 Shell Programming and Scripting 3 05-12-2005 12:42 PM
Joining multiple lines beilstwh Shell Programming and Scripting 4 03-02-2005 05:51 AM
Joining lines in log file bubba112557 Shell Programming and Scripting 3 05-18-2004 08:10 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-09-2005
Sabari Nath S Sabari Nath S is offline
Registered User
  
 

Join Date: Jul 2005
Location: Chennai
Posts: 46
Joining 3 lines at a time

Hi,

I have a file which has the contents as below :

07:38:36 EST
date 20041117
07:39:06 EST
07:00:29 EDT
date 20050504
07:25:16 EDT
07:00:40 EDT
date 20050505
07:23:12 EDT

I need to delete the new line character from all lines except 3rd,6th,9th etc. lines so that i get the output as below :

07:38:36 EST date 20041117 07:39:06 EST
07:00:29 EDT date 20050504 07:25:16 EDT
07:00:40 EDT date 20050505 07:23:12 EDT

How can I achieve this ?? I tried some combinations of sed which I know but no success ...... for eg: sed 'N;s/\n/ /' can join pairs of lines ... but not 3 lines at a time .. I am searching for some kind of one liner like that .. not a script ..

Can anyone pls help ??
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0