Search all files under current directory, look for xml node ‘
find . |xargs -n1 xmlstarlet sel -t -c “//processorInfo[@ruleType=’store’]” 2>/dev/null > /cygdrive/b/allstore.txt
Ronald Pringadi's Technical Notes
Constantly Learning
Search all files under current directory, look for xml node ‘
find . |xargs -n1 xmlstarlet sel -t -c “//processorInfo[@ruleType=’store’]” 2>/dev/null > /cygdrive/b/allstore.txt
xmlstarlet sel -t -c “//YOUR_NODE_ELEMENT_TAG_NAME[@ATTRIBUTE_NAME=’ATTRIBUTE_VALUE’]” YOUR_XML_FILE.xml
# ==========================
# 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
put the line above to .vimrc
map
map