B
Bryan
Looked in the faq, helpful but still didnt figure out a clean way to do
something more advanced (for me):
I have a file with this kind of stuff in it:
+some identifying string 1
aaabbbbcccccdddd
eeeffffaaabcbcbaad
jjkalddd
+some identifying string 2
ggaadryyyyssaaad
ddddeeeakkkkalllla
asdfffff
I need to process the file and dump the results into a new file. The
file should be processed in the following manner:
1. Any line that starts with '+' should be untouched and dumped to the
new file
2. Any lines that are not empty should be joined with whatever lines are
not empty following them, up to the empty line.
3. The joined line needs to be searched for a pattern and then truncated
after the pattern.
So if my search string was (case insensitive) ddddeee, the output file
would look like this:
+some identifying string 1
aaabbbbcccccddddeee
+some identifying string 2
ggaadryyyyssaaadddddeee
Using index and substr, I can match and get the truncated version of the
joined string... but I am not sure how to loop over my file, and in some
cases use just one line and in others join lines.
I tried fiddling with $/ = "", or $/ = "+", but couldn't get what I wanted.
Suggestions appreciated,
B
something more advanced (for me):
I have a file with this kind of stuff in it:
+some identifying string 1
aaabbbbcccccdddd
eeeffffaaabcbcbaad
jjkalddd
+some identifying string 2
ggaadryyyyssaaad
ddddeeeakkkkalllla
asdfffff
I need to process the file and dump the results into a new file. The
file should be processed in the following manner:
1. Any line that starts with '+' should be untouched and dumped to the
new file
2. Any lines that are not empty should be joined with whatever lines are
not empty following them, up to the empty line.
3. The joined line needs to be searched for a pattern and then truncated
after the pattern.
So if my search string was (case insensitive) ddddeee, the output file
would look like this:
+some identifying string 1
aaabbbbcccccddddeee
+some identifying string 2
ggaadryyyyssaaadddddeee
Using index and substr, I can match and get the truncated version of the
joined string... but I am not sure how to loop over my file, and in some
cases use just one line and in others join lines.
I tried fiddling with $/ = "", or $/ = "+", but couldn't get what I wanted.
Suggestions appreciated,
B