01-06-2012
[Help me!] Print text between two strings
Deal All,
I have problem for this:
input file : "data.txt"
R 240 585694.59946146.8 8.0 239 585694.09946134.3 8.0 238 585693.59946121.8
8.01R 237 585693.09946109.3 8.0 236 585692.59946096.9 8.0 235 585692.19946084.4
8.01R 234 585691.59946071.9 8.0 233 585691.09946059.5 8.0 232 585690.59946047.0
8.01R 12 585675.19943302.8 8.0 11 585675.59943290.3 8.0 10 585675.89943277.9
8.01R 9 585676.29943265.4 8.0 8 585676.59943252.9 8.0 7 585676.99943240.4
8.04V0333-077 1 1002 02859.39S11746 8.45E 585561.59946596.0
56.42361531 8 S0333-077 12 1002 029 7.56S11746 7.69E 585538.29946345.4
56.42361531 8 Z0333-077 11 1002 029 7.70S11746 9.29E 585587.59946341.0
58.02361531 8 Z0333-077 12 1002 029 7.56S11746 7.69E 585538.29946345.4
58.02361531 8 T0333-077 1 1 1002 03052.83S1174612.33E 585681.19943113.3
56.42361531 8 T0333-077 1 2 1002 03053.01S11746 9.28E 585586.89943107.8
56.42361531 8 T0333-077 1 5 1002 029 8.77S11746 9.12E 585582.39946308.0
56.42361531 8 T0333-077 1 3 1002 03053.00S11746 6.32E 585495.59943108.0
56.42361531 8 T0333-077 1 4 1002 03052.85S11746 3.50E 585408.39943112.8
56.42361531 8 R 240 585694.49946166.0 8.0 239 585693.99946153.5 8.0 238
585693.49946141.0 8.01R 237 585693.09946128.6 8.0 236 585692.59946116.1 8.0 235
585692.09946103.6 8.01R 234 585691.59946091.2 8.0 233 585691.09946078.7 8.0 232
585673.99943334.5 8.01R 12 585674.39943322.0 8.0 11 585674.69943309.6 8.0 10
585674.99943297.1 8.01R 9 585675.39943284.6 8.0 8 585675.69943272.1 8.0 7
585405.79943186.5 8.04V0333-077 1 1003 02858.77S11746 8.45E
585561.69946615.2 60.2236153116 S0333-077 11 1003 029 7.08S11746 9.28E
585587.39946360.2 60.2236153116 Z0333-077 11 1003 029 7.08S11746 9.28E
585587.39946360.2 61.8236153116 Z0333-077 12 1003 029 6.93S11746 7.68E
585537.99946364.6 61.8236153116 T0333-077 1 1 1003 03052.19S1174612.30E
585680.29943132.7 60.2236153116 T0333-077 1 2 1003 03052.38S11746 9.26E
585586.39943127.1 60.2236153116 T0333-077 1 5 1003 029 8.15S11746 9.11E
585582.09946327.3 60.2236153116 T0333-077 1 3 1003 03052.37S11746 6.29E
585494.59943127.2 60.2236153116 T0333-077 1 4 1003 03052.23S11746 3.48E
585407.69943131.8 60.2236153116 R 240 585694.39946185.1 8.0 239
585693.89946172.6 8.0 238 585693.39946160.1 8.01R 237 585692.99946147.7 8.0 236
585692.49946135.2 8.0 235 585691.99946122.7 8.01R 234 585691.59946110.3 8.0 233
585673.79943328.7 8.0 10 585674.19943316.2 8.01R 9 585674.49943303.7 8.0 8
585674.79943291.2 8.0 7 585675.09943278.8 8.01R 6 585675.49943266.3 8.0 5
585404.69943218.3 8.0 721 585405.09943205.8 8.04V0333-077 1 1004
02858.14S11746 8.46E 585561.89946634.6 61.8236153124 S0333-077 12 1004
029 6.30S11746 7.67E 585537.69946384.0 61.8236153124 Z0333-077 11 1004
029 6.45S11746 9.27E 585587.09946379.5 63.4236153124 Z0333-077 12 1004
029 6.30S11746 7.67E 585537.69946384.0 63.4236153124 T0333-077 1 1 1004
03051.57S1174612.27E 585679.29943151.9 61.8236153124 T0333-077 1 2 1004
03051.75S11746 9.24E 585585.69943146.3 61.8236153124 T0333-077 1 5 1004
029 7.52S11746 9.10E 585581.69946346.6 61.8236153124 T0333-077 1 3 1004
03051.74S11746 6.26E 585493.59943146.6 61.8236153124 T0333-077 1 4 1004
03051.58S11746 3.45E 585406.79943151.5 61.8236153124 R 240 585694.19946204.3
8.0 239 585693.69946191.8 8.0 238 585693.29946179.3 8.01R 237 585692.79946166.8
8.0 236 585692.39946154.4 8.0 235 585691.89946141.9 8.01R 234 585691.39946129.4
8.0 11 585672.89943347.8 8.0 10 585673.19943335.4 8.01R 9 585673.49943322.9
8.0 8 585673.89943310.4 8.0 7 585674.19943297.9 8.01
Desired output is as follows: "output.txt"
R 240 585694.59946146.8 8.0 239 585694.09946134.3 8.0 238 585693.59946121.8 8.01
R 237 585693.09946109.3 8.0 236 585692.59946096.9 8.0 235 585692.19946084.4 8.01
R 234 585691.59946071.9 8.0 233 585691.09946059.5 8.0 232 585690.59946047.0 8.01
R 12 585675.19943302.8 8.0 11 585675.59943290.3 8.0 10 585675.89943277.9 8.01
R 9 585676.29943265.4 8.0 8 585676.59943252.9 8.0 7 585676.99943240.4 8.04
V0333-077 1 1002 02859.39S11746 8.45E 585561.59946596.0 56.42361531 8
S0333-077 12 1002 029 7.56S11746 7.69E 585538.29946345.4 56.42361531 8
Z0333-077 11 1002 029 7.70S11746 9.29E 585587.59946341.0 58.02361531 8
Z0333-077 12 1002 029 7.56S11746 7.69E 585538.29946345.4 58.02361531 8
T0333-077 1 1 1002 03052.83S1174612.33E 585681.19943113.3 56.42361531 8
T0333-077 1 2 1002 03053.01S11746 9.28E 585586.89943107.8 56.42361531 8
T0333-077 1 5 1002 029 8.77S11746 9.12E 585582.39946308.0 56.42361531 8
T0333-077 1 3 1002 03053.00S11746 6.32E 585495.59943108.0 56.42361531 8
T0333-077 1 4 1002 03052.85S11746 3.50E 585408.39943112.8 56.42361531 8
R 240 585694.49946166.0 8.0 239 585693.99946153.5 8.0 238 585693.49946141.0 8.01
R 237 585693.09946128.6 8.0 236 585692.59946116.1 8.0 235 585692.09946103.6 8.01
R 234 585691.59946091.2 8.0 233 585691.09946078.7 8.0 232 585673.99943334.5 8.01
R 12 585674.39943322.0 8.0 11 585674.69943309.6 8.0 10 585674.99943297.1 8.01
R 9 585675.39943284.6 8.0 8 585675.69943272.1 8.0 7 585405.79943186.5 8.04
V0333-077 1 1003 02858.77S11746 8.45E 585561.69946615.2 60.2236153116
S0333-077 11 1003 029 7.08S11746 9.28E 585587.39946360.2 60.2236153116
Z0333-077 11 1003 029 7.08S11746 9.28E 585587.39946360.2 61.8236153116
Z0333-077 12 1003 029 6.93S11746 7.68E 585537.99946364.6 61.8236153116
T0333-077 1 1 1003 03052.19S1174612.30E 585680.29943132.7 60.2236153116
T0333-077 1 2 1003 03052.38S11746 9.26E 585586.39943127.1 60.2236153116
T0333-077 1 5 1003 029 8.15S11746 9.11E 585582.09946327.3 60.2236153116
T0333-077 1 3 1003 03052.37S11746 6.29E 585494.59943127.2 60.2236153116
T0333-077 1 4 1003 03052.23S11746 3.48E 585407.69943131.8 60.2236153116
R 240 585694.39946185.1 8.0 239 585693.89946172.6 8.0 238 585693.39946160.1 8.01
R 237 585692.99946147.7 8.0 236 585692.49946135.2 8.0 235 585691.99946122.7 8.01
R 234 585691.59946110.3 8.0 233 585673.79943328.7 8.0 10 585674.19943316.2 8.01
R 9 585674.49943303.7 8.0 8 585674.79943291.2 8.0 7 585675.09943278.8 8.01
R 6 585675.49943266.3 8.0 5 585404.69943218.3 8.0 721 585405.09943205.8 8.04
V0333-077 1 1004 02858.14S11746 8.46E 585561.89946634.6 61.8236153124
S0333-077 12 1004 029 6.30S11746 7.67E 585537.69946384.0 61.8236153124
Z0333-077 11 1004 029 6.45S11746 9.27E 585587.09946379.5 63.4236153124
Z0333-077 12 1004 029 6.30S11746 7.67E 585537.69946384.0 63.4236153124
T0333-077 1 1 1004 03051.57S1174612.27E 585679.29943151.9 61.8236153124
T0333-077 1 2 1004 03051.75S11746 9.24E 585585.69943146.3 61.8236153124
T0333-077 1 5 1004 029 7.52S11746 9.10E 585581.69946346.6 61.8236153124
T0333-077 1 3 1004 03051.74S11746 6.26E 585493.59943146.6 61.8236153124
T0333-077 1 4 1004 03051.58S11746 3.45E 585406.79943151.5 61.8236153124
R 240 585694.19946204.3 8.0 239 585693.69946191.8 8.0 238 585693.29946179.3 8.01
R 237 585692.79946166.8 8.0 236 585692.39946154.4 8.0 235 585691.89946141.9 8.01
R 234 585691.39946129.4 8.0 11 585672.89943347.8 8.0 10 585673.19943335.4 8.01
R 9 585673.49943322.9 8.0 8 585673.89943310.4 8.0 7 585674.19943297.9 8.01
Please, help. Tanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I'm working on a large file and need to extract all data between 2 strings. I have seen many good solutions to threads almost like my problem but none that quite fit.
This is all very new to me so any ideas would be really appreciated! (attempted to read sed and awk tutorials but got a... (9 Replies)
Discussion started by: soots
9 Replies
2. Shell Programming and Scripting
Hello,
I have a file like this..
2 168611167 STK39 STK39 --- 27347 "serine threonine kinase 39 (STE20/SPS1 homolog, yeast)" YES SNP_A-2086192 rs16854601 0.001558882
6 13670256 SIRT5 /// RPS4X SIRT5 --- 23408 /// 6191 "sirtuin (silent mating type... (5 Replies)
Discussion started by: genehunter
5 Replies
3. UNIX for Dummies Questions & Answers
hi all! i have a file like this
lea 25 female
dave 18 male
jake 27 male
and i want to have an output file like this
my name is lea. i am 25. female
my name is dave. i am 18. male
my name is jake. i am 27. male
thanks! (2 Replies)
Discussion started by: engr.jay
2 Replies
4. Shell Programming and Scripting
Deal All,
I have problem for this:
input file : "data.txt"
R 240 585694.59946146.8 8.0 239 585694.09946134.3 8.0 238 585693.59946121.8
8.01R 237 585693.09946109.3 8.0 236 585692.59946096.9 8.0 235 585692.19946084.4
8.01R 234 585691.59946071.9 8.0 233 585691.09946059.5 8.0 232... (2 Replies)
Discussion started by: aksin
2 Replies
5. UNIX for Dummies Questions & Answers
Hi Team,
Would you please help me for the below scenario.
I want to print the text between "PREF:" AND "AVAIL:" in the below example.
For example:-
TEST_TAF PREF: RAC1 RAC2 RAC3 ...... AVAIL: RAC4
Output will be :-RAC1,RAC2,RAC3.............
Thanks in Advance
Shoan
... (5 Replies)
Discussion started by: shoan
5 Replies
6. Shell Programming and Scripting
I have one script which gave final output as the below statment.
Successfully added Nomination Petition Manifest to the Content Manager.
Now i want a sed statement which will search for this statement in any given file and print only Nomination Petition Manifest. I don't want to hardcore... (13 Replies)
Discussion started by: Vikram_Tanwar12
13 Replies
7. Programming
Hi,
Here is an example:
I have a grep line:
grep -i -r -H "$WORD" "$DIRECTORY"with an output like this:
/media/dir/dir2//dir4/file.txt:/media/dir/dir2/dir3/file_16072008/es6.txt: "content of the file found from grep"/media/dir/dir2/dir3/dir4/file3.txt:/media/dir/dir2/dir3//file.txt:"other... (3 Replies)
Discussion started by: Hornys
3 Replies
8. UNIX for Dummies Questions & Answers
Currently, I have a print filter that takes a text file, that convert it into PCL which then gets to a HP printer. This works.
Now I need to embedded a image file within the text file.
I'm able to convert the image file into PCL and I can cat both files together to into a single document... (1 Reply)
Discussion started by: chedlee88-1
1 Replies
9. Shell Programming and Scripting
hey,
i m having a hard time trying to print only the first occurrence between 2 idenicale strings.
for the following output:
please
help
me im a
noob
please
im a noob
help me
noob
please
help
me im a
noob
please
im a noob
help me
noob (3 Replies)
Discussion started by: boaz733
3 Replies
10. Shell Programming and Scripting
hey guys,
for the following output:
starting
open
open
close
close
starting
close
starting
open
close
close
starting
open
open
close
open (2 Replies)
Discussion started by: boaz733
2 Replies