multiple action!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting multiple action!
# 1  
Old 05-03-2012
multiple action!

lets explain it easy by showing the initial file and desired file:
I've a file such this that contains:
initial_file:
Code:
31/12/2011 23:46:08    38.6762    43.689    14.16    Ml 3.1     
                                                                                                                 
TypeID    GroupID    EventID    BulletinID    CodeID    Station    Component    Phase    Quality    Day    Month    Year    Hour    Minute    Second    Residual    Polarity    Hypo    Weight    Duration    Amplitude Type    Amplitude    Period    Md    Ml    Mb    Ms    Mw    Distance    Azimuth 
1    0    2.01112E+13    1325375174    52    TVAN    Z    P    I    31    12    2011    23    46    13.8469    -0.27    0    1    0    0    C    25253.24    0.18    0    3.4    0    0    0    30.01    235.7882 
1    0    2.01112E+13    1325375174    290    VMUR    Z    P    I    31    12    2011    23    46    13.9996    -1.99    0    1    0    0    C    3182.026    0.13    0    3.2    0    0    0    36.28    343.7596 
1    0    2.01112E+13    1325375178    331    CLDR    Z    P    I    31    12    2011    23    46    17.9258    -0.27    0    1

desired_file:
Code:
31/12/2011 23:46:08 38.6762 43.689 14.16 Ml 3.1     
1    0    2.01112E+13    1325375174    52    TVAN    Z    P    I    31    12    2011    23    46    13.8469    -0.27    0    1    0    0    C    25253.24    0.18    0    3.4    0    0    0    30.01    235.7882 
1    0    2.01112E+13    1325375174    290    VMUR    Z    P    I    31    12    2011    23    46    13.9996    -1.99    0    1    0    0    C    3182.026    0.13    0    3.2    0    0    0    36.28    343.7596 
1    0    2.01112E+13    1325375178    331    CLDR    Z    P    I    31    12    2011    23    46    17.9258    -0.27    0    1       0

Moderator's Comments:
Mod Comment Code tags for code, please.
# 2  
Old 05-03-2012
So you want to remove the second and third lines?

Code:
sed '2,3d' < input > output

This User Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Action on all files in a folder

How can I do an action to all files in a specific folder? Do I use ls and a loop or something else? Does ls take folder location? (2 Replies)
Discussion started by: locoroco
2 Replies

2. Shell Programming and Scripting

Check date and do action

I would like to write a script to do such thing , if a directory have file that the extension is today (yymmdd), then do a specific action , I will run a cron job to run this script . For example Today is 2nd , if the directory have files which file name are abc.121102 and def.121102 ,... (6 Replies)
Discussion started by: ust3
6 Replies

3. Shell Programming and Scripting

Need help with find its action

I am writing a shell script that takes at least 2 arguments. The first is an octal representation of file permissions, the second is a command that is executed on all the files found with that permission. #!/bin/sh find . -perm $1 -exec $2 $3 $4 {} \; invoked: ./script.sh 543 ls -la what... (3 Replies)
Discussion started by: computethis
3 Replies

4. Shell Programming and Scripting

same action in then as in else: explanation?

in /etc/init.d/networking of an ubuntu computer, I found this code: if ifdown -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi Shouldn't it be replace by ifdown -a --exclude=lo ... (0 Replies)
Discussion started by: raphinou
0 Replies

5. UNIX for Advanced & Expert Users

tracking user action

Hi, we are using solaris8. we have some files disappear. I would like to know how to track who and when the files was remove ??? thanks, (7 Replies)
Discussion started by: xitrum
7 Replies

6. Shell Programming and Scripting

action command

Hi.. When i refered the script /etc/rc.sysinit... i found the "action commands" like But this is not working in my shells.. the following error is coming... Please anybody help Thanks in advance esham (5 Replies)
Discussion started by: esham
5 Replies
Login or Register to Ask a Question