Last gasp for me. :)
Code:
sed '/.* A/,/TER/{/HET/d}' file.txt |
Quote:
I figured out what the problem is. SED looks for the start string more then once. Is there a way to limit SED to start looking and stop look just once? |
How about beginning with the first line?
Code:
sed -n "0,/^TER/p" file.txt |
Quote:
The problem is after TER, there is another line with " HETATM...............A ", I dont want anything before " HETATM...............A " and after "TER". SED reads the lines after TER too. How do i avoid that? This is my command right now sed -n "/^ATOM\|HETA.................A/, /^TER/p" It should read if the line starts with ATOM or HETA followed by 16 characters and then A. The 16 characters can be anything... |
Threads merged because they are essentially the same.
|
Quote:
is there a way to read just the first thread? |
Code:
sed -ne '0,/^TER/ !d' -e '/^.\{14\}A/,$ p' file.txt |
Quote:
The file is in the following format ATOM[or HETA] [14 random charaters] A 100 lines like this TER ATOM[or HETA] [14 random charaters] B 100 lines like this TER ATOM[or HETA] [14 random charaters] C 100 lines like this TER HETA [14 random charaters] A 100 lines like this TER HETA [14 random charaters] B 100 lines like this TER So i need to get A, B and C[Starting with ATOM or HETA] into seperate files. but i dont want the lines if the whole string starts only with HETA. So i want ATOM[or HETA] [14 random charaters] A 100 lines like this TER into A.txt and ATOM[or HETA] [14 random charaters] B 100 lines like this TER into B.txt so the command should not have '0,/^TER/ !d' as it will count only A and not B or C. |
All times are GMT -5. The time now is 06:01 PM. |