Cli favourites: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Line 5: Line 5:


== convert files from dos to unix ==
== convert files from dos to unix ==
 
<syntaxhighlight lang="bash">
find -name "*.cpp" | xargs perl -pi -e 's/\r\n/\n/g'
find -name "*.cpp" | xargs perl -pi -e 's/\r\n/\n/g'
</syntaxhighlight>


==find large files==
==find large files==

Revision as of 00:44, 26 November 2022

compare two files

diff -y -w --suppress- workrequestAll.orig workrequestAll.new

convert files from dos to unix

find -name "*.cpp" | xargs perl -pi -e 's/\r\n/\n/g'

find large files

find /home/iwiseman -size 10M 

gawk usage

This nicely removes the total line in ls and prints the filename

ls -l | sed /^total/d |gawk  {'print $9'}

sed search and replace

Replace text in file

sed -i -e 's/fff/ddd/g' iain.txt

print list of filenames using awk

ls -l |gawk -F \  {'print $9,$5'}