How can I insert character to end of file?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How can I insert character to end of file?
# 1  
Old 01-29-2008
How can I insert character to end of file?

Hello all
How can I insert character to the end of text file without opening it in vi
Just simple one liner, can it be done?
Tnx
# 2  
Old 01-29-2008
is this what you want:
Code:
echo hooray one liner >> file

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use sed to insert character in the beginning of file path?

I need to manipulate one Database file on Solaris 11 in which contains more than 5000 lines of data file path like this: '/data1/oradata/DBNAME/system01.dbf', '/data7/oradata/DBNAME/undotbs1_01.dbf', '/data1/oradata/DBNAME/sysaux01.dbf', '/data28/oradata/DBNAME/userdata01.dbf', ... (6 Replies)
Discussion started by: duke0001
6 Replies

2. Shell Programming and Scripting

Insert character at specific location in a each line of the file

Hi All, I am trying to write a shell script where it should insert character 'I' in 180th position of each line(except first and last line) of the file. Below is the script for file in /home/test/bharat/*.RET do # Process file echo "File Name=" $file #l_fileName="${file##*/}" ... (19 Replies)
Discussion started by: bharath561989
19 Replies

3. Shell Programming and Scripting

How to add newline character at end of file?

Hi All, I have following piece of code in UNIX C Shell script and I want to add one more command which can add newline at the end of file only if there is no newline character exists. foreach file (`ls $dd_PLAYCARD_EDI_IN`) if ( -f $dd_PLAYCARD_EDI_IN/${file} ) then cat -n... (4 Replies)
Discussion started by: jnrohit2k
4 Replies

4. Shell Programming and Scripting

How to remove new line character at end of file.

I need to remove new line character from end of file. Suppose here are content. a|b|c|d|r a|b|c|d|r a|b|c|d|r <new line> that means file contains 4 lines but data is there in 3 lines. so I want that only 3 lines should be there in file. Please help (20 Replies)
Discussion started by: varun940
20 Replies

5. Shell Programming and Scripting

add character to every end-of line in file

Hi All I have a file which conatins record.the length of every records is 47. problem : in the end of record i don't have a "\015" character. i want to add this "\015" charcter in the end of every record. the file contains something like 700 records. i've tried with sed command - nothing. ... (8 Replies)
Discussion started by: naamas03
8 Replies

6. Shell Programming and Scripting

Insert character in a specific position of a file

Hi, I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this? I tried to add it at 5th position using the below code. It didnt work. Please help!!! awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Discussion started by: gpaulose
1 Replies

7. Shell Programming and Scripting

Insert two strings at the beginning and at the end of each line of a file

Hi, excuse me for my poor english. My problem is that: I have a File i want to add to each line of that file two strings: one at the beginning of the line, one at the ending. string1="abcd" string2="efgh" i want $string1 content $string2 for each line. Is that possible? (3 Replies)
Discussion started by: Linux-fueled
3 Replies

8. Shell Programming and Scripting

How to insert a string at the end of a file read

Hi, This thread is an extension of the post I posted in another folder for Unix Dummies. I am actually trying to read all the files in a folder, let say folder A. There are alot of .txt files in this folder where I have sed them and translate to numeric elements. For example:- I have... (5 Replies)
Discussion started by: ahjiefreak
5 Replies

9. Shell Programming and Scripting

How to delete a character at the end of a file.

I am having a file which has data like this:- 1,2,3,4,5, But I need to remove the last comma from this file. So the data should be like 1,2,3,4,5 The command I tried was temp=`cat ${FileName}.txt` len=`awk '{print length($0)}' ${FileName}.txt` len=`expr $len - 1` ... (12 Replies)
Discussion started by: rony_daniel
12 Replies

10. Shell Programming and Scripting

Edit and insert character in a text file

Hello All, Can somebody please help me how to accomplish the following : I have a text file called data.txt that has the following information : M|88494-998494 M|98jd#0094 M|88394-994049 M|GFG9980#009944 and so on... I need to replace the value of M to either "S" or "X"... (3 Replies)
Discussion started by: negixx
3 Replies
Login or Register to Ask a Question