Monday, April 27, 2015

Auto login through putty

Step 1:
Double click putty.exe file, and load saved session



Step 2:
double click on PUTTYGEN.EXE file, and then click on generate button




Step 3:



Step 4:
click save public key button and save public key in .txt file
click save private key button and save private key in .ppk file
if u want you can ignore warnings(I ignored).

Step 6:
goto connection-> Data windows and give auto login username



Step 7:
goto Connection->SSH->Auth Window and give path of private Key
goto Session and save your loaded session
load saved session again and log on to destination machine


Step 8:

copy key - content from PUTTYGEN.EXE window and past it in file
~/.ssh/authorized_keys2
on destination machine and save the file



Step 10:

Log out of machine and login again
your auto login is ready this time it wont ask for password confirmation

Sunday, June 21, 2009

To upper case every char after space

awk '{ for ( i=1; i <= NF; i++)
{ sub(".", substr(toupper($i),1,1) , $i) }
print }' infile

How can you convert a text file to all lower case or all upper case?

As usual, in Linux, there are more than 1 way to accomplish a task.

To convert a file (input.txt) to all lower case (output.txt), choose any ONE of the following:


* dd

$ dd if=input.txt of=output.txt conv=lcase


* tr

$ tr '[:upper:]' '[:lower:]' < input.txt > output.txt


* awk

$ awk '{ print tolower($0) }' input.txt > output.txt


* perl

$ perl -pe '$_= lc($_)' input.txt > output.txt


* sed

$ sed -e 's/\(.*\)/\L\1/' input.txt > output.txt


We use the backreference \1 to refer to the entire line and the \L to convert to lower case.



To convert a file (input.txt) to all upper case (output.txt):


* dd

$ dd if=input.txt of=output.txt conv=ucase


* tr

$ tr '[:lower:]' '[:upper:]' < input.txt > output.txt


* awk

$ awk '{ print toupper($0) }' input.txt > output.txt


* perl

$ perl -pe '$_= uc($_)' input.txt > output.txt


* sed

$ sed -e 's/\(.*\)/\U\1/' input.txt > output.txt

reference from
http://linuxcommando.blogspot.com/2008/05/how-to-convert-text-files-to-all-upper.html

Read line from file shell script

while read myline
do
echo $myline
done < myfile

oring grep command

$ grep 'apples\|oranges' fruits.txt
green apples
red oranges
red apples

Colorfull grep search

export GREP_OPTIONS='--color=auto'

Monday, May 18, 2009