|
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
Last edited by harish_oty; 10-03-2006 at 06:27 AM..
|