There are two mistakes.
1. You must also set OFS to / otherwise the modification of $5, causing a rebuild of $0, uses the default OFS (output field separator is a space).
2. There must be a space between -v and z=
Not important here: gsub tries multiple substitutens, sub is sufficient here.
And there are bugs with brackets if the first argument in sub or gsub is in quotes. Better use slashes as first choice.
This User Gave Thanks to MadeInGermany For This Post:
I have a script run_batch.sh as below :-
PAR_VALIDATION=val_siconf
PAR_RUN_LEVEL=1
PAR_EXCLUSIVE_RUN_YN=Y
DATABASE_USER="/@"$TWO_TASK
sqlplus -s $DATABASE_USER |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off... (1 Reply)
Hi,
I have a program in which i have to substitute a TAG in a file with the value of a variable.
Code Snippet:
----------------
myvar=1234
sed 's/_TAG_/$myvar/' infile outfile
When I run this command, the _TAG_ in the "infile" is substituted with "$myvar" but NOT the value "1234"... (1 Reply)
Hello
please how can i change this infrormation within a file dynamically without using vi " || $6 ~ /^229*/ " the * means any number within
the file has this content :
cat lec|awk -F '|' 'length($6) >= 12 || length($6) <= 10' |awk -F '|' '$6 ~ /^24/ || $6 ~ /^22924/ &&$7 ~... (1 Reply)
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
I have a Linux C program I'm writing that has one section where, within a large string, I need to substitute a smaller string for another, and those probably won't be the same size.
For instance, if I have a string:
"Nowisthetimeforallgoodmen"
and I want to substitute 'most' for 'all' the... (2 Replies)
Can SED be used to substitute a character (y) with a character (Y) in a specified field?
File has 12000 : delimeted rows as;
HHC 1 BDE:Lastname, Firstname MI:firstname.mi.lastname@mil:SGT
HHC 2 BDE:Lastname, Firstname MI:Firstname.MI.Lastname@mil:SGT
I wish to replace the capital letters... (6 Replies)
Hi Gurus
this is working finee with tested values
#!/bin/ksh
V_DATE="2007-11-30"
V_ID=789
V_NAME="john_${V_ID}_has_${V_DATE}_s"
FILE_NAME=`echo ${V_NAME}`
echo ${FILE_NAME}
Buttt the problem is
the first two values will come dynamically
and the file will looks like... (2 Replies)
Hi All,
my requirement is as below.
I need to replace a value in a particular column with a substitution variable(date value) and modified value of the current column value in the same position.
for ex.
i have a record like
02;aaaa;bbbbb;cccccc;dddddd;123456789;hhhhh;12hs;asdf ;... (3 Replies)
Hi All,
OS HPUX 11.11
I am using following script to take controlfile backup. I have used SID variable to hold "ffin1" value, which I again subsitute in "'/db/ffin1/home/oraffin1/$SID_$wdate.ctl'" command. Well, after running this, SID variable does not subsittue it's value, while wdate... (6 Replies)
Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare
nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)