Hi,
Are there any options for using options like RPAD(),LPAD() functions in SQL?If yes, How can I use grep command with thease options?
Any help would be appreciated.
Thanks in Advance.
-Harish
Hi,
Are there any options for using options like RPAD(),LPAD() functions in SQL?If yes, How can I use grep command with thease options?
Any help would be appreciated.
Thanks in Advance.
-Harish
Hi harish,
I don't know about those function (SQL). can you give more details. 
Thanks
Hi Srikanth,
Consider below:-
test___1
test___2
test__10
test_110
Thease are the contents of a file where the number column is right aligned.
Please consider "___" symbol as blank spaces.
If I want to extract "test 110", I give grep "test $no" where no is a variable and consider now it is 110. This will extract "test 110". If I want to extract "test 10", If I give the same command grep "test $no", where no is 10, It won't extract because of it has got 2 blank spaces between test and 10. So I need to have a option like LPAD in other languages, E.g. LPAD("10",3," ") will return 1 blank space followed by 10. So I can assign this value to a variable and now the value can be no=" 10". Now I can go with grep, It will work.
I hope you understood this.
Any suggestion on this?
TIA
-Harish
I think , It would be helpful for you
FILE=input_filename
no=10
cat $FILE | awk '$2 ~ /'"$no"'/ {print $1 " " $2}'
if any problem ..pls don't hesitate to ask help..
Thanks
Srikanth
try this
no=1
grep "test *$no$" file
or
no=1
sed -n "/test *$no$/p" file
Another way using grep :
grep "test[[:space:]]*$no" file
Jean-Pierre.