2. Replace that first line with a new first line, which would read
3. Have that information placed into file2.y
Unfortunately, I'm having a problem. Sed keeps giving me some kind of command error.
Why is this happening?
Agent,i think we can't use the special variable $1 to access the first field of the line read from file as in awk.These variables can only be used after a regular expression match was done in sed.See the below code
The above code will match for '5' in the readed line and then that matched expression was replaced using $1 variable in the curly braces with 'New' as an action.
In your code,since there wasn't a regex usage the $1 variable is undefined and thereby shows error.
Hi falks,
I need to substitute in my ksh program, parameter (full path of directory) ,which is sent from outside program, with another parameter (another full path of directory) ,which is known and validated inside my program.
I tried to use "sed" ,but i failed.
For example:
... (2 Replies)
Hi,
I'm trying to use the sed command but I'm not sure how to use it properly. I've read the man pages for the sed command but I'm still unsure on how to use it.
Basically I have a file with the words male and female written multiple times. I want to swap the word male for female and... (4 Replies)
I have a group of xml files and I need to insert 3 parameters just after this line in each file:
---------------Pattern to be searched for-------------------------
<!--The following configuration is a test configuration-->
---------------Parameters to be added---------------------------... (11 Replies)
Hi,
The config file:
# Port(s) for accepting client connections
RTSPPort=554
bash-3.00# awk -F"=" -v gr="888" '/RTSPPort/{$2=gr;}1' OFS="=" server.ini
awk: syntax error near line 1
awk: bailing out near line 1
Can you help me on why this doesn't work.
The next one neighter. Dosn't... (0 Replies)
i have a file acc.sh which has about 10 lines and then i have defined $var which has a line number in it (say 5). i want to extarct from line 5 to the end of the file and put the output into another file. I have used
sed -n $var,'$p' acc.sh | tee abc.sh
but at times it does'nt work and gives an... (6 Replies)
Hi everyone!
I have a file like that:
And I would it like that:
I don't know how to keep the first field and sort the second one.
I have a second question with sed...
to put the variable $VAR at the beginning of the file...
But I have an output like this:
snork... (3 Replies)
$ echo "a,0,0,0,b,0" | sed 's/,0,/,1,/g'
gives output as
$ a,1,0,1,b,0
rather than as
a,1,1,1,b,0
how can i solve this problem
Thanks a lot in advance....
Use code tags. (4 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Okay so I am taking bash scripting this semester and we are now working on the stream editor sed. For our book we... (4 Replies)
Hello,
I have spent a couple of hours trying to answer this myself, so forgive me if the answer is simple but I have tried.
I have a text file generated from svn log output which contains a list of files.
Two regexps im using are
*
and
*
They both work but some lines has a mixture... (7 Replies)