8/9/12

UNIX Commands


COPY THE FIRST 10 LINES FROM ONE FILE TO ANOTHER FILE :
sed -e "10q" GDK2120_D1.TXT > GDK2120_D2.TXT

-----------------------------------
COUNT THE NUMBER OF FILES IN THE FOLDER :

 ls -1|wc -l    [-ONE & -L]
-----------------------------------
CHECKING DISK SPACE :
df -h
or
df -k
or
du -sh

-----------------------------------
MIGRATE FOLDERS FROM ONE ENVIRONMENT TO ANOTHER ENVIRONMENT(EX: DEV TO QA)
scp -rp /home/data user@dev.com:/home/data

-----------------------------------
CHANGE THE OWNER OF THE FOLDER :
sudo chown -R user /home/data
-----------------------------------
TO CHECK FOR THE FILE(GREP)
ls /home/data | grep ^CED_DELTA.*TXT$
ls /home/data | grep CED_DELTA.*TXT$
-----------------------------------
to check the process of my own
ps -f -l -uusername
-------------------------------------
to convert multiple lines into one single line
awk '{printf("%s",$0)}' HPS_D1120807_142128.TXT > HPS_D1120807_142128_1.TXT
--------------------------------------------------------------------------------
to convert one single row with delimeters into multiple rows (~ is  a delimeter here)
awk -F"~" '{for(i=1 ;i <= NF;i++ ) {print $i;}}' HPS_D1120807_142128_1.TXT >HPS_D1120807_142128_2.TXT
--------------------------------------------------------------------------------
to remove the last line from the file
sed '$d' EDISAMPLE_3.TXT > EDISAMPLE_4.TXT

-------------------------------------------------------------------------
rename file with one pattern to another pattern
rename  ATTXJZZ  ATTXJGD *.ksh

-------------------------------------------------------------------
touch to change the timestamp of the file
touch -a -m -t 201301181205.09 filename.txt

0 comments:

Post a Comment