Find with xargs

Search all files under current directory, look for xml node ‘‘, copy and print that node. Send the output to a file.

find . |xargs -n1 xmlstarlet sel -t -c “//processorInfo[@ruleType=’store’]” 2>/dev/null > /cygdrive/b/allstore.txt

Bash Scripting templates


# ==========================
# Bash tips
# ==========================

# Run bash by
$ /bin/bash scriptname.sh
$ /bin/bash scriptname.sh +x # debug mode

# Or put the next line on the 1st line of your file.
#!/bin/bash -x

## Double round braket for integer
if (( $MYINT < 10 ]] #or: = ## Double square braket for string if [[ $USER = "ron" ]] #or: != then echo "Hello ron" else echo "Hello Stranger" fi $ date +%x # shows only the date 07/02/13 depending on locale, currently en_CA $ LANG=en_US $ date +%x # shows only the date 02/07/13 # ========================== # vi tips # ========================== # Using normal mode # Delete line at the cursor # type dd # Insert at cursor # type i # Insert after the cursor (append) # type a k J o # To bring in (read in) the content of an extrnal file into your current file :r ~/snippets/if # To read in a result of an executable, such as date use the :r! :r!date :r!date "+\%x" # Macro normal mode :map # Macro insert mode :map! # Macro F2 to insert text: "#This file was created on 2014-05-03" :map i#This file was created on :r!date "+\%x" kJ

put the line above to .vimrc
map i#!/bin/bash
map o#This file was created on :r!date "+\%x" kJ