Hi ahamed,
Yes, like that. But the range is in the middle of a file of hundreds of lines. So, I need the range construction.
And, I don't want to modify the line
Eventually, I want to increment the AAA variable. So, I want to pass that variable to the sed substitution. But, I can't seem to get the behavior that I want.
Thanks,
Larry
Last edited by Don Cragun; 02-24-2014 at 03:05 AM..
Reason: Add CODE and ICODE tags.
Hello,
i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem.
my var1 is a string constructed like this:
filename1 filerev1 filepath1
my var2 is another string constructed like this:
filename2 filerev2 filepath2
when i do... (2 Replies)
Hi Chaps...
I have a log file as below:-
01 Oct 2009 12:57:56 DEBUG :
01 Oct 2009 12:14:21 DEBUG :.....
.
.
.
.05 Oct 2009 14:31:56 DEBUG :....
.
.
.05 Oct 2009 12:57:56 DEBUG :....
06 Oct 2009 01:23:11 DEBUG :....
.
.
.06 Oct 2009 12:53:46 DEBUG :.... (4 Replies)
I know this script is crummy, but I was just messing around.. how do I get sed's insert command to allow variable expansion to show the filename?
#!/bin/bash
filename=`echo $0`
/usr/bin/sed '/#include/ {
i\
the filename is `$filename`
}' $1
exit 0 (8 Replies)
Hello All,
I don't write scripts very often, and in this case I am stumped, although it may be a bug in the version of bash I have to use (it's not my system).
I want to extract a specific string snippet from a block of text (coming from a log file) that is dependent on a bunch of other... (1 Reply)
Hello, I searched the forum and unable to find a solution for my particular problem. I have a text file I'm trying to insert some text using sed after finding a pattern..
File contains in one line
Invoice date: xx/xx/xxxx Balance: $$$$ Name: xxxxxxxxxxxxxx
Trying to insert Invoice "Number:... (3 Replies)
The objective of the code below is to create sed script to be later executed. However, it bonks because $ARCHIVENAME expands to a directory specification so the forward slashes cause problems. I can think of a few solutions that would involve redesigning the process, but I'm hoping there might be... (4 Replies)
Problem with the code below is that the value of the variable is not getting substituted in the sed expression.
#/bin/csh
set UNIX_ID="rajibd"
set X_ID="xrajibd"
sed -n 's/$UNIX_ID/$X_ID/g' passwd
When run , it is not giving expected output as shown below :
... (4 Replies)
The following is part of a larger project and sed is (right now) a given. I am working on a recursive Korn shell function to "peel off" XML tags from a larger text. Just for context i will show the complete function (not working right now) here:
function pGetXML
{
typeset chTag="$1"
typeset... (5 Replies)
Hi,
at academic level I am familiar with how variable substitution/expansion feature works. From your live experience, can you please tell what are real-time scenarios where ${variable:=} ${variable%pattern} ${variable:=word} sort of features can be used? How can we connect that dot that... (6 Replies)
I am unable to expand the value of entry variable inside the nawk command.
I tried three different nawk command as below but none of them substitute the value of entry variable.
ls *.txt | while IFS='' read -r entry; do
#nawk '/<name>/{A=1;++i} A{print >> ("cmd"i"_"$entry)}... (9 Replies)