A.J.Mechelynck wrote:
Nikolaos A. Patsopoulos wrote:
Hi all,
I'm very sorry to bother the list with this problem but I've been
searching in the web the couples hours to find an answer and still
haven't find any.
The problem is that I have a txt file of 3.5GB containing all the
info of Human chromosome 6. I want to save into one another file all
lines that have the pattern rs10946398 (occurring only ones). I know
that vi cannot handle files so big. I used ed in Fedora5 but this too
cannot stream it. I hope that grep or sed can do this but cannot
figure how to. I tried the following for sed but doesn't work:
sed '/rs10946398/p' chr6.txt
Can someone help?
Thank in advance,
Nikos
grep rs10946398 < chr6.txt > chr6.extract.txt
Grep is a filter, remember? It takes its input from stdin, writes its
output on stdout, and the regexp is on the command-line. The output
consists of all input lines matching the pattern.
Since in this case the pattern is a fixed string, we can also use
fgrep (or grep -F) instead of grep.
Best regards,
Tony.
Thanks,
I found also the solution with sed:
sed -n '/rs10946398/p' chr6.txt >o.txt
Thanks,
Nikos