- Published:
- February 23, 2010 – 5:41 pm
- Author:
- By Dave
My professor sent us this little one liner (ok, I had to format it to 2 lines to fit in this blog. You know what I mean) which prints out the current directory tree:
ls -R | grep “:$” | sed -e ’s/:$//’ -e ’s/[^-][^\/]*\//–/g’ \
-e ’s/^/ /’ -e ’s/-/|/’
What’s going on here?
Categories: Code Samples, Shell
Tagged: bash, sed
- Published:
- February 13, 2010 – 1:12 pm
- Author:
- By Dave
The Bash command environment, which is the namesake of this blog, is very flexible in that it allows you to manipulate the filesystem in many ways. Awk and sed are very powerful tools that allow you to do this rename with a simple one line command. This post will walk you through doing this with [...]
Categories: Code Samples, Linux, Shell, System Administration
Tagged: awk, bash, csv
- Published:
- October 14, 2008 – 3:16 pm
- Author:
- By Dave
Found a great post over at good coders code, great reuse. This one deals with performing operations on sets using only unix (bash) command line operations on files of text.
* Set Membership. Test if an element belongs to a set.
* Set Equality. Test if two sets [...]
Categories: Code Samples, Linux, Shell
Tagged: awk, bash, grep, join, sed, set operations, union
- Published:
- July 18, 2008 – 9:38 am
- Author:
- By Dave
I created this Bash script as a project for the system administration course I’m taking for the summer. I’m sure there are bugs in it, so let me know if you find any.
It basically uses an XML configuration file, which includes the source, destination, and any excludes from the transfer. You then pass either -u [...]
Categories: Code Samples, Shell
Tagged: bash, download, rsync, Shell, transfer, upload
- Published:
- April 8, 2008 – 3:32 pm
- Author:
- By Dave
Wow – I get so frustrated when I try to copy some files over old ones and I get:
[root@server1 wordpress]# cp -Rf * ../public_html/
cp: overwrite `../public_html/license.txt’? y
-R is recursive, but -f is supposed to copy over without confirmation. What could it be?!
Check out your alias command using ‘alias’:
[root@server1 wordpress]# alias
alias cp=’cp -i’
Sure enough – alias [...]
Categories: Linux, Shell, System Administration
Tagged: bash, copy, HTML