Sponsored Content
Top Forums Shell Programming and Scripting Using SED to append character to each line Post 302079301 by c0nn0r on Saturday 8th of July 2006 07:56:42 PM
Old 07-08-2006
Quote:
Originally Posted by c0nn0r
I found the answer on this forum... sorry for the repeat.

Here is the link to the post that helps:

https://www.unix.com/unix-for-dummies-questions-and-answers/21191-using-sed-append-text-end-each-line.html
Actually this implementation does not work for me. Not entirely at least.

I do get the output I am looking for with this, ie.:

.
.
.
10 0 8;
10 0 8;
10 0 8;
10 0 7;
10 0 8;
.
.
.

However, it strips either the carriage return or the new line, or both, which I need to retain. For example:

running

/amstracker -u 0.05 -s | sed 's/$/;/'

gives the output seen above, but if I try running

/amstracker -u 0.05 -s | sed 's/$/;/' | sed 's/$/;/'

Which I should be able to do (it would just add another ';' to each line right?)

In reality I see nothing in the terminal when I run this.

I'm trying to add a newline or carriage return after the ;, but I'm not sure how...

Again, I'm a SED newb.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

append a character at end of each line of a file

Hi, i want to append a character '|' at end of each line of a file abc.txt. for example if the file abc.txt conatins: a|b|c 1|2|33 w|2|11 i want result file xyz.txt a|b|c| 1|2|33| w|2|11| I know this is simple but sumhow i am not able to reach end of line. its urgent, thanks for... (4 Replies)
Discussion started by: muaz
4 Replies

2. Shell Programming and Scripting

Sed append newline character

Hi All, I am new to Shell scripting.. I have a task to parse the text file into csv format. more then half the things has done. But the problem is when I use the sed command in shell script. it appends newline character at the end of the line. and so when I open the file in CSV it's format... (3 Replies)
Discussion started by: Gaurang033
3 Replies

3. Shell Programming and Scripting

How to append a character to the last but one field on a specific line?

Hi Guys, I have a file like this: aaa b c d e f fsss g h i k l qqq r t h n I want: aaa b c d e f fsss g h i k l qqq r t h , n ggg p t e d u qqq i o s , k (2 Replies)
Discussion started by: npatwardhan
2 Replies

4. Shell Programming and Scripting

How to append line with sed?

Input: gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly Output should be: gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly How can it be done with sed? (5 Replies)
Discussion started by: cola
5 Replies

5. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

6. Shell Programming and Scripting

sed append without using new line

im trying to append to the end of the line using sed but I want to do it without creating a new line the text to which I want to append is all in capital letters. I want to do something like this: LINE]Foo but when I do this: //a\ ] Foo it prints foo on a new line: LINE ]Foo ... (11 Replies)
Discussion started by: mrjavoman
11 Replies

7. Shell Programming and Scripting

Search for a string, then append character to end of that line only

I have 2 files that I am working with $ cat file1 server1 server3 server5 server6 server8 $ cat file2 server1;Solaris; server2; SLES; server3;Linux; server4; Solaris; server5;SLES; server6;SLES; server7;Solaris; server8;Linux; (1 Reply)
Discussion started by: snoman1
1 Replies

8. Shell Programming and Scripting

Sed: delete on each line before a character and after a character

Hi there, A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis). The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies

9. Shell Programming and Scripting

sed - append line after block

Hi, I posted in another section, but no reply yet. I have an ini file with sections denoted as follows (for example) blah=blah blee=blee bloo=bloo blur=blur blaa=blaa I have ksh script that needs to append a line ${line} to the end of section ${section} I saw this... (7 Replies)
Discussion started by: andyatit
7 Replies

10. UNIX for Beginners Questions & Answers

Append each line based upon the character size

I have a huge file which contains multiple lines. It need to check whether character length is not more than 255 each line. If its not then it should remove the character up to column. I have described in the output below. If its more than that the next line should start with call but if the... (1 Reply)
Discussion started by: JoshvaPeter
1 Replies
OUTPUT_RESET_REWRITE_VARS(3)						 1					      OUTPUT_RESET_REWRITE_VARS(3)

output_reset_rewrite_vars - Reset URL rewriter values

SYNOPSIS
bool output_reset_rewrite_vars (void ) DESCRIPTION
This function resets the URL rewriter and removes all rewrite variables previously set by the output_add_rewrite_var(3) function or the session mechanism (if session.use_trans_sid was set on session_start(3)). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 output_reset_rewrite_vars(3) example <?php session_start(); output_add_rewrite_var('var', 'value'); echo '<a href="file.php">link</a>'; ob_flush(); output_reset_rewrite_vars(); echo '<a href="file.php">link</a>'; ?> The above example will output: <a href="file.php?PHPSESSID=xxx&var=value">link</a> <a href="file.php">link</a> SEE ALSO
output_add_rewrite_var(3), ob_flush(3), ob_list_handlers(3), session_start(3). PHP Documentation Group OUTPUT_RESET_REWRITE_VARS(3)
All times are GMT -4. The time now is 05:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy