[Solved] Remove White spaces from teh beginnning from a particular row

Hi All,

$sed -n "58p" sample 
 
     1222017  ---

Its has to display like:

1222017

Try:

awk 'NR==58{print $1}' file
1 Like

Hello,

Here is aan exmaple for same.

echo "test_!234" | sed 's/[[:space:]]//g;s/[[:punct:]]//g'
test234

Hope it may help.

Thanks,
R. Singh

1 Like

Thankyou both , it worked

Here is an example, don't know how is your real file

$ echo "     1222017  ---" | awk 'NR==line{gsub(/[[:punct:]]/,x); $0=$0; $1=$1}1' line="1"
1222017

Try also:

sed -nr '58s/^[[:space:]]*|[[:space:]][[:punct:]]*$//gp' file