Wednesday, January 20, 2016

unix cmds

$ /usr/local/bin/pbrun ksh

--> validate xml
xmllint --valid xmlfile1.xml

xmllint --valid --noout doc.xml
xmllint --schema schema.xsd doc.xml




-->uniq -d test
 Print only Duplicate Lines using -d option (http://www.thegeekstuff.com/2013/05/uniq-command-examples/)

-->List the files containing a particular word in their text
grep check * -lR

grep '/opt/BAES_HOME/conf/wlm/fpfa' * -lR  (it will show all the files having word '/opt/BAES_HOME/conf/wlm/fpfa')


---->grep -c 'id="' DJRC_WL-AMe_XML_201510072359_F.xml
count word id=" in a file
grep -o "<item>" a.xml | wc -l

--->Find Java class inside a folder of JARS

 for a in *.jar
 do
 echo $a; unzip -t $a | grep -i CLassFileName
 done
==>unzip -t my.jar
==>unzip -t quartz.jar|grep -i 'Pair.class'


-->
awk 'FNR==1 && NR==1{printf $1"|"}FNR==1 && NR!=1{printf $1"\n"}' file1.txt file2.txt

paste -d"|" file1.txt file2.txt
paste -d"|" file1.txt file2.txt
http://www.folkstalk.com/2012/09/paste-command-examples-in-unix-linux.html


-->if ORACLE_HOME is not defined
find / \( -name catalog.sql -o -name sql.bsq \)
/u01/app/oracle/product/12.1.0/client_1/bin

https://kb.iu.edu/d/acar

-->http://design.liberta.co.za/articles/how-to-remove-spaces-from-filenames-in-linuxunix/

--grep -P "[\x80-\xFF]" *.*

->to remove non printable chars in a file.

perl -pe's/[[:^ascii:]]//g' < ACCOUNTS_DAILY_20121206.txt > newfile_accounts_ascii.txt

--->cut -d "," -f1-10,20-25,30-33 infile.csv > outfile.csv
-->http://www.shellhacks.com/en/Printing-Specific-Columns-Fields-in-Bash-using-AWK
-->ls -p | grep -v /

No comments:

Post a Comment