Shell-script - Replace newline tab space previous line, Move a line with tabe space to previous line
Replace newline tab space previous line
Lets consider a file a called replace-newline.txt. Here our requirement is to move the line to a previous line and get the output to the device number. when the device number is printed in the next line we are unable to list or see the device number. And hence we wann to move the next line with tabe space and remove the new line and move it to the previous line. This scrip might be a bad idea, but plese feel free to post your comments so that we will consider it and it might be useful to many peoples.sdsdfsdf part 42 sdfsdfsdf part 45 fdsfsdfsdf part 59
#!/bin/bash while read line do aa=${#line} if [ $aa -eq 0 ] then echo "-------" else echo -n "$line " fi done<replace-newline.txt
# sh replace-live-with-tab.shBy executing the above script, we will get the outpus as below, From which we can extract the output.
OUTPUT:
sdsdfsdf part 42------- sdfsdfsdf part 45------- fdsfsdfsdf part 59
The topic on Shell-script - Replace newline tab space previous line is posted by - Math
Hope you have enjoyed, Shell-script - Replace newline tab space previous lineThanks for your time