Sunday, 30 March 2014

Useful linux operations (inspired by linux commando)

Inspired by linux commando's blog posts (http://linuxcommando.blogspot.com), i will be adding a list of helpful commands that have helped me in my research experiments down here.

1. Convert a file's content to all lower case

Using Perl

prompt> perl -pe '$_=lc($_)' < inputfile > outputfile

Using SED

prompt> sed -e 's/\(.*\)/\L\1/' < inputfile > outputfile




2. Convert files from DOS or MS Windows that have ^M\n to a file with a single line of text where ^M is removed

Using Perl

perl -pi -e 's/\r\n/ /g' < inputfile > outputfile

No comments:

Post a Comment