Re: extracting information
From: rakesh sharma (sharma__r_at_hotmail.com)
Date: 02/28/04
- Next message: Laurent Vogel: "Re: sed 'n' Repeats Last Line"
- Previous message: rakesh sharma: "Re: sed problem...simpler solution?"
- In reply to: Lars Roland: "extracting information"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Feb 2004 21:27:53 -0800
Lars Roland <roland@diku.dk> wrote in message news:<Pine.LNX.4.58.0402271129250.26672@brok.diku.dk>...
> I have a large collection of files where most of the information's are useless,
> what i want is to extract the information i need out of them and
> delete the rest.
>
> Eg. the files contain a line starting with:
>
> Information:
>
> What i want to do is to delete the rest of the file except the line
> starting with Information: - can this be done ???
If there are not too many files in your current directory, then this will do:
for fname in ./* ./.*;do
[ -f /tmp/LOGFILE ] && continue
grep -l '^Information:' $fname > /dev/null && \
sed -e '
/^Information:/q;d
' $fname >> /tmp/LOGFILE
done
- Next message: Laurent Vogel: "Re: sed 'n' Repeats Last Line"
- Previous message: rakesh sharma: "Re: sed problem...simpler solution?"
- In reply to: Lars Roland: "extracting information"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]