![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| command for selecting specific lines from a script | gardasgangadhar | UNIX for Dummies Questions & Answers | 1 | 05-13-2008 02:29 AM |
| shell script to search content of file with timestamps in the directory | psychobeauty | Shell Programming and Scripting | 10 | 04-21-2008 02:37 AM |
| Retreive content between specific lines ina file | chennaitomcruis | Shell Programming and Scripting | 4 | 04-19-2008 07:18 AM |
| Help with selecting specific lines in a large file | tansha | UNIX for Dummies Questions & Answers | 2 | 02-06-2008 05:26 AM |
| shell script to edit the content of a file | tiger99 | Shell Programming and Scripting | 3 | 01-31-2008 01:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Urgent: selecting unique specific content of a file using shell script
Hi,
I have a file whose content and format at places is as given below. coloumn .... coloumn .... coloumn .... skip 1 line coloumn ... skip 1 line I need to select the following : coloumn .... coloumn .... coloumn .... skip 1 line and write it into a new file. And the next coloumn ... skip 1 line should be again written to another new file.Both by using shell script. Thanks in advance JS |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
num=1
while read line
do
[[ "$line" != "END" ]] && { echo "$line">>file_number.$num; }|| { echo "END">>file_number.$num; (( num = num + 1 )); }
done<file
|
|
#3
|
||||
|
||||
|
With Awk:
Code:
awk '{close(FILENAME"_"f-1);print>(FILENAME"_"($1=="print"?++f:f))}' data
|
||||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|