Advertisements

On 22 Feb 2004 20:45:17 -0800, ajay <> wrote:
> In log file i have lines like this:
>
> 01-22T09:26:24.560 [00504] (tShell) {0xd071920}
> Alcap_menu::send_establish_response] | SUCCESS
>
> It's single line. now i want to remove first 3 columns( better to say
> first 3 set of strings seperated by spaces) of line and retain rest of
> line, i.e I want to have only this:
>
> Alcap_menu::send_establish_response] | SUCCESS
>
> How to do it in a single perl command ?

Does preserving exact whitespace matter?

perl -lane 'print "@F[3..$#F]"'

If it does:

perl -pe "s/^\S+\s+\S+\s+\S+//"

Or the now leading space should also go:

perl -pe "s/^\S+\s+\S+\s+\S+\s+//"

replace \s+ with ' ' or \t or whatever if the whitespace is more
restrictively defined (which would allow \S* to be useful for empty
fields...)

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!