Monday, January 16, 2012

Script

multiple variables  from file
 while read -r a b; do  ./iu-copy  -S imap.rediffmailpro.com/$b/$a -D 127.0.0.1/$b/$a ; done < emerg >> emerg.log 2>&1
 
 
cat 1|cut -d"." -f3-4 -- to cut last three and four octet of IP

awk '{n=split($0,A,".");S=A[n];{for(i=n-1;i>0;i--)S=S"."A[i]}}END{print S}'  to reverse print the IP  
 
find  /home/raji/inbound/ -type f|egrep -iv Archive|xargs -i mv -f "{}" 
/home/raju/inbound/Archive/"  #To Archive the file to Archive directory 
 from ftp server end
 
 
echo "techmed-VM38.secure.redaid.com_mysql_hot_backup_2012091205.xbstream.gpg" | sed 's/.gpg//'
 
 
 
mount
 
mount |column -t  
=============
 
 Simple script to list all active and system users.

------------------------[cut]------------------
#!/bin/bash
_l="/etc/login.defs"
...
 
 
 
To remove all gems 
 
'gem list | cut -d" " -f1 | xargs gem uninstall -aIx'


Pass yes/no reply for overwriting

yes n|cp -i   ====== no for overwriting
yes y|cp -i   ======  for overwriting
To removal ALL the files and not any subdirectories in /dest type the following
find /dest -type f -delete

To removal only the files and ot any subdirectories in /dest type the following:

find /dest -maxdepth 1 -type f -delete
Script to copy files for Particular date

ls -ali |grep -i Aug | grep -i 2011 |awk {'print $10'}|xargs -I '{}' mv {} /home/sanoj/123

Replace

replace 'dest word' 'source word' -- file.txt

Find and Copy file.

find . -name02022_201201140501042684. -exec cp {} /123/ \;

No comments:

Post a Comment