Archive

Archive for the ‘unix commands’ Category

Grep Before and after lines in unix

Syntax: Before lines (3- is the number of lines before your search text here)

grep -B3 “Your search text” your file name

Syntax: After Lines (3- is the number of lines after your search text here)

grep -A3 “Your search text” your file name

 

Advertisements
Categories: Technical, unix commands

How to remove cap in the barcode generated in unix from postscript

printf(“0 setlinecap\n”);

Print the above line to the output postscript file before generating the barcode….

 

 

split in shell script

January 13, 2012 Comments off

OLDIFS=$IFS
set -f
IFS=’,’ # comma is my delimitter
LISTARRAY=($LIST)
set +f

IFS=$OLDIFS
for i in ${listARRAY[@]}
do
echo “$i”
done

Categories: Technical, unix commands

lower case to upper case in unix

January 13, 2012 Comments off

echo “your string” | tr [:lower:] [:upper]

Categories: Technical, unix commands

Replace a string in VIM

January 4, 2012 Comments off

Replace in the entire file:

——————————

Open Vi Editor, Press Esc

then type :s/string/replacestring/ press enter

Ex:

:s/karu/nand/ press enter

Replace with in some lines:

———————————-

:linefrom,linetos/string/replacestring/ press enter

Ex:

1,10s/karu/nand/ press enter

Categories: Technical, unix commands

column number in VI editor

November 9, 2011 Comments off

How to see column number in Vi Editor?

Esc : set ruler

Above command will show column number in the bottom right corner of the window.

Categories: Technical, unix commands

remove ctrl m from unix files

Using vi editor, Open the file and in command mode
Esc :%s/.$//g

Categories: Technical, unix commands