The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 01-16-2008
in2nix4life's Avatar
in2nix4life in2nix4life is offline
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'
Reply With Quote