Sponsored Content
Full Discussion: Insert Text On file
Top Forums Shell Programming and Scripting Insert Text On file Post 302345845 by Shazin on Thursday 20th of August 2009 10:53:51 AM
Old 08-20-2009
Hia,

You can also use:
Code:
sed '1i\ USER_ID, LOGIN_ID' file_name > new_filename
cp new_filename file_name
rm new_filename

Cheers,
Shazin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

insert text into a dinamic file

I need help, It's probably a joke for you, but I'm about to explode: This is it: I have a file which is created by batch, and includes a list of db files (with the complete path). I want to use this list for a graph file - in order to exclude it from the daily backup. it means i need to add an... (2 Replies)
Discussion started by: sunbird
2 Replies

2. Shell Programming and Scripting

insert text in the middle of a file

I want to insert a text into the middle of a file (3 Replies)
Discussion started by: relle
3 Replies

3. UNIX for Dummies Questions & Answers

How to insert text in the middle of a file

Hey guys, how do we take a line of text as an argument from a user and then insert it in the middle of a file irrespective of the number of lines in the file. I am trying to do this without SED or AWK. Inserting it in the beginning and at the end is easy, but i am trying to accomplish inserting... (6 Replies)
Discussion started by: kartikkumar84@g
6 Replies

4. Shell Programming and Scripting

How to insert some constant text at beginig of each line within a text file.

Dear Folks :), I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp. I can do this in vi editor by using this command :g/^/s//BBB_ e,g I have a file named as Test.dat and it containins below text: michal... (4 Replies)
Discussion started by: Muhammad Afzal
4 Replies

5. Shell Programming and Scripting

Need to insert new text and change existing text in a file using SED

Hi all, I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output. sed '$a\ hi... ' shell > shell1 But I face problem when using the same in script. It is throwing the error as, sed: command garbled:... (4 Replies)
Discussion started by: iamgeethuj
4 Replies

6. Shell Programming and Scripting

Insert text to file via ssh

I want to create a script that will set up key pairs from "thishost" to "remotehosts". I have a validate script in ~/<dir> that I need to prefix the generated key in the authorized_keys file, and I'm having to manually do this everytime. Here are my attemps, perhaps you could perfect them for... (3 Replies)
Discussion started by: ScannerDarkly
3 Replies

7. UNIX for Dummies Questions & Answers

insert comma in a text file

Hi all, I have a text file and I need to insert comma after every 2 digit. -1-1-1-1-1-1-1-1-1 0 0 0 -1-1-1 2 0 0 3 311-1 0 1 -1-1 021 0 011-1-1 033 0I'd like to have this: -1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0 -1,-1,-1, 2, 0, 0, 3, 3,11,-1, 0, 1 -1,-1, 0,21, 0, 0,11,-1,-1, 0,33, 0Thanks for... (7 Replies)
Discussion started by: GoldenFire
7 Replies

8. Shell Programming and Scripting

Insert value to db from text file

Hi, I have a single value in insertval file. I want to load that value to database with the current date. I tried the below code but it is inserting <NULL> to database and echo $c is also null. cat insertval | awk -F ' ' '{print $1}' > c echo c=$c data=`sqlplus -s user/pwd@hostname <<EOF ... (5 Replies)
Discussion started by: Neethu
5 Replies

9. Shell Programming and Scripting

How to insert text using a second file in Linux

How can i insert text at a particular line number or before/after a search pattern? The text i want to insert is of 8-10 lines including new line characters. I have stored this text in a separate file. I know i can use sed '{/pattern/|/regexp/|n}{i|a|c}<text to be inserted>' file But i want... (7 Replies)
Discussion started by: abhitanshu
7 Replies

10. Shell Programming and Scripting

How to insert text within a file?

Hi, I am trying to check for missing dates in a file and would want to insert the missing date into the file. Currently the script is as below #!/bin/ksh dates="dates" cat ${dates} | grep -v "^#" curr_month=`date '+%m` curr_day=`date '+%d` curr_year=`date '+%Y` #curr_month=02... (7 Replies)
Discussion started by: newbie_01
7 Replies
XmTextReplace(3X)														 XmTextReplace(3X)

NAME
XmTextReplace - A Text function that replaces part of a text string SYNOPSIS
#include <Xm/Text.h> void XmTextReplace (widget, from_pos, to_pos, value) Widget widget; XmTextPosition from_pos; XmTextPosition to_pos; char * value; DESCRIPTION
XmTextReplace replaces part of the text string in the Text widget. The character positions begin at zero and are numbered sequentially from the beginning of the text. An example text replacement would be to replace the second and third characters in the text string. To accomplish this, the parameter from_pos must be 1 and to_pos must be 3. To insert a string after the fourth character, both parameters, from_pos and to_pos, must be 4. This routine calls the widget's XmNvalueChangedCallback and verification callbacks, either XmNmodifyVerifyCallback or XmNmodifyVerifyCall- backWcs, or both. If both verification callback lists are registered, the procedures of the XmNmodifyVerifyCallback list are executed first and the resulting data is passed to the XmNmodifyVerifyCallbackWcs callbacks. Specifies the Text widget ID Specifies the start posi- tion of the text to be replaced Specifies the end position of the text to be replaced Specifies the character string value to be added to the text widget For a complete definition of Text and its associated resources, see XmText(3X). SEE ALSO
XmText(3X), XmTextReplaceWcs(3X) XmTextReplace(3X)
All times are GMT -4. The time now is 06:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy