Check These Out
This assumes you are in the cwd of where you put your s3 scripts. Its useful if someone decides to create aws cloudformation scripts and doesn't add the 'yaml' or .yml extension.
Uses line-porcelain in git blame, which makes it easier to parse the output.
Fetches the world population JSON data from the US census and parses it uses jshon
'ps' let you specify the format that you want to see on the output.
Replace 'csv_file.csv' with your filename.
Copy this function to command line, press 'Enter' 'f'' 'Enter' to execute (sentence on the left written only for newbies). Hint 'e|x|v|1..9' in front of displayed last modified file name means: "Press 'e' for edit,'x' for execute,'v' for view or a digit-key '1..9' to touch one file from the recent files list to be last modified" and suggested (hidden files are listed too, else remove 'a' from 'ls -tarp' statement if not intended).
If you find this function useful you can then rename it if needed and append or include into your ~/.bashrc config script. With the command
$ . ~/.bashrc
the function then can be made immediately available.
In the body of the function modifications can be made, i.e. replaced joe editor command or added new option into case statement, for example 'o) exo-open $h;;' command for opening file with default application - or something else (here could not be added since the function would exceed 255 chars).
To cancel execution of function started is no need to press Ctrl-C - if the mind changed and want to leave simple Enter-press is enough. Once defined, this function can with
$ typeset -f f
command be displayed in easy readable form
You can do some boolean logic like
A or B then C else D using
or : ||
and : &&
So you can do some :
# false || false && echo true || echo false
false
# true || false && echo true || echo false
true
# false || true && echo true || echo false
true
# true || true && echo true || echo false
true
and so on ...
I use it like :
$(ssh example.com 'test something') || $(ssh example.net 'test something') && echo ok || echo ko
Replace \-dev with whatever you wanna search for
Using awk, find duplicates in a file without sorting, which reorders the contents. awk will not reorder them, and still find and remove duplicates which you can then redirect into another file.
Just a quick and simple one to demonstrate Bash For loop. Copies 'file' to multiple ssh hosts.