10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a file(testfile.txt) that contains list of variables as shown below. T
$$FirstName=James
$$LastName=Fox
$$Dateofbirth=1980-02-04
……and so on there are 50 different variables.
I am writing a script(script1.sh) that will update the above three variable one by one with the values... (6 Replies)
Discussion started by: Saanvi1
6 Replies
2. Shell Programming and Scripting
Hello I am hoping you may help.
I am not sure how to go about this exactly, I know the tools but not sure how to make them work together.
I have two SED commands that I would like to run in a shell script. I would like to take
the manual input of a user (types in when prompted) to be used... (4 Replies)
Discussion started by: lostincashe
4 Replies
3. Shell Programming and Scripting
I am trying to print text between two variables in a file
I have tried the following things but none seem to work:
awk ' /'$a'/ {flag=1;next} /'$b'/{flag=0} flag { print }' file
and also
sed "/$a/,/$b/p" file
But none seem to work
Any Ideas?
Thanks in Advance (5 Replies)
Discussion started by: forumbaba
5 Replies
4. Shell Programming and Scripting
hi guys,
The following command doesn't seem to work in my shell script:
tag=$(sed -n '/${line}/ s/.*\.*/\1/p' myfile.txt)
When i replace the ${line} with an actual value, it works fine.
So, how do i use the ${line} in this sed command?
Thanks in advance,
Zaff (2 Replies)
Discussion started by: zaff
2 Replies
5. Shell Programming and Scripting
Can I use my own variables within awk and sed for example:
I've written a while loop with a counter $i and I want to use the value of $i within sed and awk to edit certain lines of text within a data file.
I want to use :
sed '1s/$/texthere/g' data.csv
Like this:
sed '$is/$/$age/g' data.csv... (5 Replies)
Discussion started by: mustaine85
5 Replies
6. Shell Programming and Scripting
Hello,
I wonder if it is possible to pass and use variables from shell environment into sed or awk. I am trying to achieve something similar to the following using sed or awk:
var=some_regular_expression
grep "$var" filename # Will extract lines from filename
The following code,... (3 Replies)
Discussion started by: nasersh
3 Replies
7. Shell Programming and Scripting
Hi all-
I've been fooling with this for a few days, but I'm rather new at this...
I have a bash variable containing a long string of various characters, for instance:
JUNK=this that the other xyz 1234 56 789
I don't know what "xyz" actually is, but I know that:
START=he other
and ... (2 Replies)
Discussion started by: rev66
2 Replies
8. Shell Programming and Scripting
Hello ,
I have a script named testscript.sh
wherein I have two variables $var and $final (both of which contain a number)
I have a sed write function inside this script as follows:
sed '1,2 w somefile.txt' fromfile.txt
Now , in the above i want to pass $var and $final instead of... (2 Replies)
Discussion started by: shweta_d
2 Replies
9. Shell Programming and Scripting
I have been searching around the forums here trying to find a solution to my problem but not getting anywhere but closer to baldness.
I have a 20 column pipe "|" seperated text file. The 14th variable doesnt always exist, but will have the format of YYYYMM or YYYY if it does.
I need to take... (2 Replies)
Discussion started by: r0sc0
2 Replies
10. Shell Programming and Scripting
I am trying to pass a regular expression variable from a simple script to sed
to remove entries from a text file
e.g.
a='aaaa bbbb cccc ...|...:'
then executing sed from the script
sed s'/"'$a"'//g <$FILE > $FILE"_"1
my output file is always the same as the input file !!
any... (5 Replies)
Discussion started by: Daniel234
5 Replies