954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

inserting characters in text files through shell script

hi, i need to insert a character in a certain text file. i cannot change the original files so i have to work with that, luckily the files are written in a way that at the end of every second line a semicolon ; has to be inserted. How can i do this? thanks in advance

jorritgoddijn
Newbie Poster
3 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 
hi, i need to insert a character in a certain text file. i cannot change the original files so i have to work with that, luckily the files are written in a way that at the end of every second line a semicolon ; has to be inserted. How can i do this? thanks in advance


you should give an example or a sample of the contents of the original file and your expected output.

ghostdog74
Junior Poster
156 posts since Apr 2006
Reputation Points: 75
Solved Threads: 44
 
you should give an example or a sample of the contents of the original file and your expected output.

Thanks but i found out already

jorritgoddijn
Newbie Poster
3 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
 
sed 'n;s/$/;/' filename > newfilename
jim mcnamara
Junior Poster
180 posts since May 2004
Reputation Points: 62
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You