You are not logged in.

#1 2008-07-15 17:43:42

gobeav3rs297
Member
From: Portland Oregon
Registered: 2007-11-06
Posts: 60

tail command question

Hi,

I want the tail command to output the end of a file up to a certain word/delimiter, is it possible?  I know I can set set a certain line number, but that's flexible enough.  I'm sure it can be done, I just not as familiar with linux commands just yet.  Thanks for the help.

Vincent

Offline

#2 2008-07-15 17:52:52

daf666
Member
Registered: 2007-04-08
Posts: 470
Website

Re: tail command question

You can try mixing the tail with grep and cut to do some more good

Offline

#3 2008-07-15 18:19:06

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: tail command question

I found this among the sed one liners here : http://student.northpark.edu/pemente/sed/sed1line.txt

 # print section of file from regular expression to end of file
 sed -n '/regexp/,$p'

But the problem is that it does it from the first occurrence of the word / delimiter / regexp, which might not be what you want.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#4 2008-07-15 18:38:12

gobeav3rs297
Member
From: Portland Oregon
Registered: 2007-11-06
Posts: 60

Re: tail command question

shining,

Thank you, I think this might just be exactly what i'm looking forward, I try it and report back.

Vincent

Offline

#5 2008-07-16 04:05:34

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: tail command question

awk 'BEGIN {RS="nonoccurring123332134" ; FS="the line"} {print $2}' filename

Offline

Board footer

Powered by FluxBB