The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Need help to parse the file
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Directory
Register
Forum Rules
FAQ
Contribute
Members List
Search
Today's Posts
Mark Forums Read
Thread
:
Need help to parse the file
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
01-16-2008
in2nix4life
Registered User
Join Date: Oct 2007
Location: East Coast
Posts: 47
Alternatively, in
Perl
:
#!/usr/bin/
perl
while(<>) {
chomp;
s/^\#.*//g;
s/"//g;
s/{|}//g;
s/\(.*\)//g;
s/\[.*\]//g;
s/\d*//g;
s/Sec/sec/g;
s/\s+/,/g;
s/^\s+$//g;
chop;
print "$_\n" unless(/^$/);
}
Run as 'parsefile.pl file.txt'
in2nix4life
View Public Profile
Find all posts by in2nix4life