2014/09/26
Update bash
yum localinstall https://kojipkgs.fedoraproject.org//packages/bash/4.2.47/2.fc19/i686/bash-4.2.47-2.fc19.i686.rpm
2014/09/19
Sed
Print only lines you want:
sed -n 41,43p file.txt
sed -n 42p file.txt
Tabs to spaces:
sed -i.bak -re 's/\t/ /g' file1
Print lines matching pattern:
sed -ne '/Failed: [^0]/p' results.txt
Delete a line matching pattern and the following 4 lines:
sed -e /pattern/,+4d file
Delete lines matching certain regex:
rg regex -l dir | xargs sed -i '' -E '/regex/d'
find dir -type f | xargs sed -i -E '/regex/d'
echo -e 'file1 \n file2' | xargs sed -i -E 's/regex1/regex2/g'
echo -e 'file1 \n file2' | xargs perl -p -i -e 's/regex1/regex2/g'
sed -n 41,43p file.txt
sed -n 42p file.txt
Tabs to spaces:
sed -i.bak -re 's/\t/ /g' file1
Print lines matching pattern:
sed -ne '/Failed: [^0]/p' results.txt
Delete a line matching pattern and the following 4 lines:
sed -e /pattern/,+4d file
Delete lines matching certain regex:
rg regex -l dir | xargs sed -i '' -E '/regex/d'
find dir -type f | xargs sed -i -E '/regex/d'
echo -e 'file1 \n file2' | xargs sed -i -E 's/regex1/regex2/g'
echo -e 'file1 \n file2' | xargs perl -p -i -e 's/regex1/regex2/g'
Subscribe to:
Posts (Atom)