How to prepend spaces using sed command..?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to prepend spaces using sed command..?
# 1  
Old 08-08-2014
How to prepend spaces using sed command..?

hi all ,
i had the below sed command to append header at the starting of my output file ....
Code:
sed -i -e '1i saikumar   suresh    hemanth' output.txt

i want to append spaces to the Name saikumar how can i append with in this command ....?

Last edited by hemanthsaikumar; 08-08-2014 at 02:27 AM.. Reason: wrong type .. typed name for same
# 2  
Old 08-08-2014
Try e.g.
Code:
sed -e '1i\    saikumar   suresh    hemanth'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Gnu tool; sed awk echo etc to prepend or append string to a file

Looking to add text to a file, example File example; nodegroups: check-hosts: L@host.domain.com,host2.domain.com,host3.domain.com I need to take a file with a one line list of hosts separated by commas host.domain.com,host2.domain.com,host3.domain.comand prepend the string " ... (6 Replies)
Discussion started by: bash_in_my_head
6 Replies

2. Shell Programming and Scripting

Can't remove spaces with sed when calling it from sh -c

The following command works echo "some text with spaces" | sh -c 'sed -e 's/t//g''But this doesn't and should echo "some text with spaces" | sh -c 'sed -e 's/ //g''Any ideas? (3 Replies)
Discussion started by: Tribe
3 Replies

3. Shell Programming and Scripting

sed prepend text ?

Hi, I have a file with email header information. I would like to change the Subject line. Subject: ** PROBLEM Host Alert: server.domainname is DOWN ** I'd like to change this line such as to look, Subject: serverID ACK Fw: ** PROBLEM Host Alert: server1.domainname is DOWN** How can I... (2 Replies)
Discussion started by: upengan78
2 Replies

4. Shell Programming and Scripting

sed with escapes AND spaces?

It's been covered in lots of places, and I have banged on it for about an hour and I am not making any headway on this particular string. A weather-related web page I want to monitor has text on the screen, but it changes. Right now, the page has "None issued by this office recently." but in 2... (4 Replies)
Discussion started by: Habitual
4 Replies

5. Shell Programming and Scripting

tr and sed remove spaces. how to stop this?

if the answer is obvious, sorry, I'm new here. anyway, I'm using tr to encrypt with rot-13: echo `cat $script | tr 'a-zA-Z' 'n-za-mN-ZA-M'` > $script it works, but it removes any consecutive spaces so that there is just one space between words. I've had this problem before while using sed to... (5 Replies)
Discussion started by: Trichopterus
5 Replies

6. Shell Programming and Scripting

How to Use Sed Command to replace white spaces with comma from between two fields - Mayank

SHELL SCRIPT Hi I have a file in the following format Mayank Sushant Dheeraj Kunal ARUN Samir How can i replace the white space in between and replace them with a comma?? The resultant output should be Mayank,Sushant Dheeraj,Kunal ARUN,Samir i tried using sed -e... (8 Replies)
Discussion started by: mayanksargoch
8 Replies

7. UNIX for Dummies Questions & Answers

Tab spaces with sed

Anyone know how to represent tabs when doing subsitutions in sed? I have tried using \t but it doesn't seem to work. (11 Replies)
Discussion started by: handak9
11 Replies

8. Shell Programming and Scripting

sed over writes my original file (using sed to remove leading spaces)

Hello and thx for reading this I'm using sed to remove only the leading spaces in a file bash-280R# cat foofile some text some text some text some text some text bash-280R# bash-280R# sed 's/^ *//' foofile > foofile.use bash-280R# cat foofile.use some text some text some text... (6 Replies)
Discussion started by: laser
6 Replies

9. UNIX for Dummies Questions & Answers

how to use sed command with alphabetical and spaces?

If have a problem with this command: name="toe der" echo $name | sed -e 's/]//g' it will become: toeder how to make it back to original? (7 Replies)
Discussion started by: elenatec
7 Replies

10. Shell Programming and Scripting

how to remove spaces in a string using sed.

Hello, I have the following to remove spaces from beginning and end of a string. infile=`echo "$infilename" | sed 's/^ *//;s/ *$//` How do I modify the above code to remove spaces from beginning, end and in the middle of the string also. ex: ... (4 Replies)
Discussion started by: radhika
4 Replies
Login or Register to Ask a Question