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
Deleting lines above a certain line eltinator Shell Programming and Scripting 3 10-11-2007 03:29 PM
Moving lines within a txt file innocentspirit Shell Programming and Scripting 5 09-28-2007 01:04 AM
deleting lines using awk-best way? satnamx Shell Programming and Scripting 3 08-29-2007 08:24 PM
Moving next 2 lines contents to previous lines Amruta Pitkar Shell Programming and Scripting 8 04-26-2007 07:09 AM
deleting lines ajnabi Shell Programming and Scripting 8 05-02-2003 12:50 PM

 
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 Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-22-2007
sabyasm sabyasm is offline
Registered User
  
 

Join Date: Sep 2005
Posts: 27
Post deleting particular lines and moving a line up using perl/sed

Hi,

I need convert a dump file in the following format : (please note that line numbers are provided for easy look)

Original file:

1 2007-10-2482.90 No trade 0 0.00 100000.00
2 100000.00
3 0.00
4 HOLD
5 2007-10-2589.75 Bought 1114 1114 100000.00 0.00
6 100000.00
7 -0.00
8 STRONG BUY
9 2007-10-2692.35 No trade 1114 102896.94 0.00
10 102896.94
11 2.90
12 STRONG BUY
13 2007-10-2991.20 No trade 1114 101615.60 0.00
14 101615.60
15 1.62
16 STRONG BUY
17 2007-10-3090.05 No trade 1114 100334.26 0.00
18 100334.26
19 0.33
20 STRONG BUY
21 2007-10-3188.45 No trade 1114 98551.53 0.00
22 98551.53
23 -1.45
24 STRONG BUY
25 2007-11-0183.70 Sold 1114 0 0.00 93259.05
26 93259.05
27 -6.74
28 STRONG SELL

Modifiled file :

1 2007-10-2482.90 No trade 0 0.00 100000.00 HOLD
2 2007-10-2589.75 Bought 1114 1114 100000.00 0.00 STRONG BUY
3 2007-10-2692.35 No trade 1114 102896.94 0.00 STRONG BUY
4 2007-10-2991.20 No trade 1114 101615.60 0.00 STRONG BUY
5 2007-10-3090.05 No trade 1114 100334.26 0.00 STRONG BUY
6 2007-10-3188.45 No trade 1114 98551.53 0.00 STRONG BUY
7 2007-11-0183.70 Sold 1114 0 0.00 93259.05 STRONG SELL


That is, every 4 line of the input file needs to converted into a single line - after deleting 2nd and 3rd line.

A perl script to do this would be great. (sed will also fulfill my purpose but perl way will be highly appreciated).

Awaiting for your 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 09:59 PM.


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