Friday, September 26, 2014

Useful *nix commands



to update

dbo.Transaction
truncate table dbo.Approval;
dbo.NextTable


to

truncate table dbo.Transaction;
truncate table dbo.Approval;
truncate table dbo.NextTable;


use this in Bash, both lines add text in the appropriate places if not already present

sed -e :a -e '/;$/!s/$/;/' file-list.sql > new-file-list.sql
sed -e :a -e '/truncate table /!s/^/truncate table /' new-file-list.sql > new2-file-list.sql

Show non ascii characters

nonascii() { LANG=C grep --color=always '[^ -~]\+'; }

printf 'ŨTF8\n' | nonascii


To remove line feeds, quotes and substitute quotes for a unique string. Used to format a field containing email content from a MySQL query extracted using concat('#K#',k.a_subject,'#K#') a

cat k2.sql | sed -e 's|["'\'']||g; s/`//g; s/#K#/\x27/g; s/\\n//g' > out.sql

Check for 8 digit numbers

grep -v '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' source.csv > without_8_digits.csv

grep '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' source.csv > with_8.csv

Extract lines in .csv with occurrences of the strings in .txt

grep -F -f client_people.txt source.csv > client_people_source.csv

sed-oneliners.

1 comment:

jane holly said...

This professional hacker is absolutely reliable and I strongly recommend him for any type of hack you require. I know this because I have hired him severally for various hacks and he has never disappointed me nor any of my friends who have hired him too, he can help you with any of the following hacks:

-Phone hacks (remotely)
-Credit repair
-Bitcoin recovery (any cryptocurrency)
-Make money from home (USA only)
-Social media hacks
-Website hacks
-Erase criminal records (USA & Canada only)
-Grade change
-funds recovery

Email: onlineghosthacker247@ gmail .com