Friday, May 6, 2016

Bash FAQ's

Using awk to extract lines in a text file

http://linuxcommando.blogspot.in/2008/04/using-awk-to-extract-lines-in-text-file.html

How to print the line number where a string appears in a file?

http://stackoverflow.com/questions/30658703/how-to-print-the-line-number-where-a-string-appears-in-a-file

To print a specific line from a file

http://www.commandlinefu.com/commands/view/3802/to-print-a-specific-line-from-a-file

How to remove space from string?

http://stackoverflow.com/questions/13659318/how-to-remove-space-from-string

Check space used by each folder in side a dir

du -h --max-depth=1

Logical Operations on grep -

$for I in `grep -l -r 'dir1/dir2/dir3/dir4/dir...n/*/*/*/`;
do
grep -l -w 'match1' $I && grep -l 'match2' $i;
done

#execute script remotely

check if number
[[ $1 =~ ^[-0-9]+$ ]] && echo "number"

return from function

Alternative for expr

for i in `grep  -w '\<param name=\"csvFile' Cir*.xml`; do echo $i; done | grep csv | cut -d '>' -f2 | cut -d '<' -f1 | grep -i ciru

while true; do grep -E 'Relations has|has finished|created ='  nohup.out ; sleep 10; clear; done

IFS=$'\n';for i in `grep -l  29513363 circuit*.csv cirucit_etfl_vlan_1.csv`; do echo $i &&head -1 $i && grep -w 29513363 $i; done| less

sudo ifconfig eth0 192.168.23.137
sudo route add default gw 192.168.23.2

Mounting shared folders on vmware 

http://askubuntu.com/questions/29284/how-do-i-mount-shared-folders-in-ubuntu-using-vmware-tools

https://www.linode.com/docs/networking/diagnostics/diagnosing-network-speed-with-iperf

https://linuxaria.com/article/tool-command-line-bandwidth-linux

on Windows
wmic cpu get VirtualizationFirmwareEnabled

No comments:

Post a Comment