awk/perl script
Honti, Balázs
balazs at fmnet.hu
Mon Jul 17 11:19:10 UTC 2006
Hello!
AWK does it for you, just have to count your columns, like this:
awk -F, '{print $1,$2,$7,$(NF-2),$(NF-5)}' <in.txt >out.txt
Your command should be this, if I also got the place of the 2 last columns
backwards correctly, and you really have "," at the end of your lines.
The output will be TAB separated, and includes the original double quotes,
which I hope, you don't mind. if you do, ...|tr -d '"' >out.txt :-)
Good luck,
Balázs
--
> i want to a awk or perl script filter a file contains the following items
> "Date","Time","RAS-Client","Record-Type","Full-Name","Auth-Type","User-Nam
> e","NAS-IP-Address","NAS-Port",,,,,,,,,,"Login-IP-Host","Login-Service","L
> ogin-TCP-Port","Callback-Number","Callback-ID",
> "07/17/2006","07:35:43","WAN","Start","Unknown","Unknown","apmc","10.16.0.
> 2
> ","20000","2","1",,,,,,,,,,,,,,,,,,"9560","53539180",
> "07/17/2006","07:35:43","WAN","Start","Unknown","Unknown","aaac","10.16.0.
> 2
> ","20000","2","1",,,,,,,,,,,,,,,,,,"9560","57532280",..............
> ..................
>
> I want to have the layput as follow
> Date Time Username Phone_No. IP_address
More information about the redhat-list
mailing list