08-05-2009
Straight forward I am executing the below scripts but it is generating the below error
STRING="<switch IP='158.195.2.567' port='5900' user='testc' password='asdfrp' Code='8'>"
awk -v string="${STRING}" 'NR == 4 {print string} $0' test_file
awk: syntax error near line 1
awk: bailing out near line 1
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi folks,
I have the following program:
#! /bin/ksh
set -xv
export grepDataSource="</data-sources>"
export DB_HOST=tornado
export SCHEMA_NAME=IAS10G
export dataSource=data-sources.xml
sourceString="<data-source class=\"oracle.jdbc.pool.OracleConnectionCacheImpl\" name=\"RiGHTvDS\"... (7 Replies)
Discussion started by: nir_s
7 Replies
2. Shell Programming and Scripting
I need to insert a file called temp_impact (which has about 15 lines in it) to a file called 11.23cfg starting at line 33. I searched the forums and found the
sed '34i\
test' 11.23cfg > newfile
That will enter word test at the appropriate line, but i need the entire file dumped there. Any... (4 Replies)
Discussion started by: insania
4 Replies
3. Shell Programming and Scripting
So I need to write lines into line X of file X.
I can get the file by doing:
cfgnumber=$(cat -n -comm.cfg| grep -i "servicegroup_name 24x7-comunicacions")
echo $cfgnumber
it outputs the Line where it finds now I need to start writing something right bellow that line.
thanks (10 Replies)
Discussion started by: 4scriptmoni
10 Replies
4. Shell Programming and Scripting
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
Hi
I need to update a number of existing files and insert #!/bin/ksh line a the first line of the file.
Is there any awk or sed command which would help me to do that instead of doing it manually?
Thanks a lot -A (10 Replies)
Discussion started by: aoussenko
10 Replies
6. Shell Programming and Scripting
sed '1r file.txt' <source.txt >desti.txt
This example will insert 'file.txt' between line 1 and 2 of source.txt.
sed '0r file.txt' <source.txt >desti.txt
gives an error message.
Does anyone know how 'sed' can insert 'file.txt' before the first line of source.txt? (18 Replies)
Discussion started by: psve
18 Replies
7. UNIX for Dummies Questions & Answers
I want to insert a line with text after the 9th line of a text file. How would I do this using sed or awk? (2 Replies)
Discussion started by: lost.identity
2 Replies
8. Shell Programming and Scripting
I have a test file that I want to read and insert only certain lines into the
the table based on a filter.
1. Rread the log file 12 Hours back Getdate() -12 Hours
2. Extract the following information on for lines that say "DUMP is
complete"
A. Date
B. Database Name
C.... (2 Replies)
Discussion started by: JolietJake
2 Replies
9. UNIX for Beginners Questions & Answers
Hi All,
I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise
My intention is to insert a line of text after 13th line of every file inside a particular directory.
While trying to do it for a single file , i am using sed
sed '3 i this is the 4th line' filename
sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 Replies
10. UNIX for Beginners Questions & Answers
My server xml file has huge data part of which i'm sharing below.
I wish to add the below text held by variable "addthisline" after the closing braces i.e --> once the first </Connector> tag is found.
addthisline="I need to be inserted after the comments"
Thus my searchstring is... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT OSF1
xmtextfieldreplace
XmTextFieldReplace(3X) XmTextFieldReplace(3X)
NAME
XmTextFieldReplace - A TextField function that replaces part of a text string
SYNOPSIS
#include <Xm/TextF.h>
void XmTextFieldReplace (widget, from_pos, to_pos, value)
Widget widget;
XmTextPosition from_pos;
XmTextPosition to_pos;
char * value;
DESCRIPTION
XmTextFieldReplace replaces part of the text string in the TextField 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 TextField widget ID Specifies the start
position 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 TextField and its associated resources, see XmTextField(3X).
SEE ALSO
XmTextField(3X), XmTextFieldReplaceWcs(3X)
XmTextFieldReplace(3X)