I am writing a shell script to do the following task.
I have a file like this:
abcdfgfehg 124353552455
ldnaslbbdaj 134314314344
sdsdbbdbu 134134134314
auosdbo 141413434444
ihjidiqwdnowqdn 134134141232
I want the output file to be
abcdfgfeh 124353552455
ldnaslbbd 134314314344
sdsdbbdbu 134134134314
auosdbo 141413434444
ihjidiqwd 134134141232
That is, all the names (1st word in every line) should be reduced to 9 characters and remaining characters trimmed. A space after that. and then the value of the name.
I know that the awk command prints the 1st word of evry line.
awk '{print $1}' ./input.txt
But how to trim the characters from the file so that each word is of length 9 and its value start after a space.
A simple printf would do –
Test:
Test 2: