[SOLVED] sed, awk, Keep only text between two regular expressions
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I see your problem comes from not reading man csplit. That comes from not having heard about csplit. If you wish, read posix csplit manual http://www.opengroup.org/onlinepubs/...es/csplit.html instead of GNU csplit manual. I doubt you meant that any POSIX-compliant utility is forbidden..
I have a directory of saved rss articles, all beginning with IS_*.
Each article has the top fields, then the body text, then a bunch of garbage at the bottome, links, etc.
My goal is to keep everything between the first blank line and a common phrase at the end of the article, and save all the articles to one file.
could you please copy and paste here a passage from one of your
and precede the beginning the passage you want to retrieve by
### scott_audio: beginning
and follow the last line of the passage by
### scott_audio: end
It would be easier to figure it out if I can have a look at the
Right off the bat it should be possible to do this via a script
shell that loops thru your files and run a sed script on them.
synss, hi, and thank you very much. Was exactly what I was looking for, a good solid example of what I was trying to accomplish... i made my loop, piped the final through sed '/./,/^$/!d' to take any double blank lines and tr -d '\n' to keep each paragrash one long line, and it worked perfectly. I'm reading up on what the double pipe means || ... looks like, though, it starts two lines down from the line that starts with 'Link:' and prints all the lines until it encounters 'Want podcasts...'
I've learned a lot and had fun, thanks again all
#better put in an absolute path for this
find $JEFF/* | while read f
if [ -d $f ]; then
#only process file if it is of type IS_something.txt
if [ "$ext" == "txt" ] && [ $(echo "$name" | grep -c '^IS_') -gt 0 ]; then
output="$dir/""$(echo $name | tr '[:upper:]' '[:lower:]')".rtf
$SEDER $input > $output
######## end of shell script ##################