Insert character by using sed/awk
I need a help that how can i insert character/digit in line by line.
I want to add 3 numeric before 34th character, 3 character after 52, 1 character after 59th and 1 character after 75th.
Can you guide me how i can write a script/command
by using sed/awk.
Here are a couple of nice sites on sed.
Here are a couple of examples to get you started.
# Add a word after the fifth character
sed 's/./&mudd/5' file.txt
# Add a word before the fifth character
sed 's/./mudd&/5' file.txt
First, do this:
But read those two man pages.
Then start with a simpler problem than your final one. Dink with it until it works. Then add complexity until you have what you want.
If, along the way, you have a detailed question about why what you wrote doesn't work, this is a really good way to ask about it. But post all the details, including your sed or awk command, your input data, your output data, and any error message.
Thanks for the prompt reply.
I managed to resolved by awk command with substr function.
Thanks once again.
|All times are GMT -5. The time now is 02:00 AM.|