Thanks for this, i'm sorry, I should have expanded on what i'm doing, i'm using a for loop and $myvar is coming from a text file
Type: Posts; User: cbillson; Keyword(s):
Thanks for this, i'm sorry, I should have expanded on what i'm doing, i'm using a for loop and $myvar is coming from a text file
I've found a way via experimentation, though appreciate thoughts if this is a good way or if there are better
VAR1="$(echo "$myvar" | sed 's/&/\\&/g')"
sed -i "s/agent-name/$VAR1/g"...
I hope someone can help as this one is driving me up the wall and i'm not sure how to fix it.
myfile:-
----
agent-name
------
Sorry, at the time of creating the post i was trying to keep the question simple, the data is more like this:
Name = bob
address = 123 any st
address1 = anytone
postcode = ab123cd
phone1...
Cheers, the source option works spot on, though I'm concerned about the next commend "hackish"
This option works, however it fails if the data has spaces.
ie
I have a file, its format is fixed as follows:
data1 = 12345
data2 = 54321
data3 = 98765
data4 = 56789
Hi, wonder if anyone could assist, I'm concerned I'm likely to lock myself out :D
I have an Ubuntu box which mostly runs a single application, which runs under root. a number of folders and logs...
i'm not sure that will work for what i hope to achieve. However, thank-you very much for that command, it could come in extremely useful..
i'm thinking use SED in the way you describe to add a...
if i had a file that contained lines such as:
name=bob smith address=123 any st town=london phone=01234567890 notes=some notes about bob smith of any length containing potentially any data
...
lets say i have a file that has:
name=123 data=blah
name=124 data=blah
name=125 data=blah
name=126 data=blah
name=127 data=blah
i need to get "123" into a variable, so i could use a for...
Thanks.. having a play now
for (( i=1; i<${#array[@]}; i++ )); do echo "array[$i]: ${array[$i]}"; done
i get that i = start of array, as mine was specified as array[1] array[2] array[3] and it...
ok, another question.. using the array with a for loop.
normally a for loop will repeat until it runs out of things to repeat on, like if you're using a file (lines) or a directory (files).
how...
you sir are a star..
thank-you to everyone who advised, much appreciated
In Dos i could do the following: i need help translating this into linux shell.
test1=bob
test2=joe
test3=ken
test4=none
set var=0
Hi, i know how to do this in DOS, and i'm hoping its possible in linux.
file1=bob
file2=joe
file3=ken
var=1
Output needs to be echo $file1
I managed to get a variation of this to do what i needed, i'm unsure why what i did first off was different to this, but i was missing something :S
Thanks to everyone who stuck with me and...
second command, should that have some reference to /var/log/syslog ?
if you take a copy of syslog at 1pm (old) and a copy at 2pm (new) and compare using diff, you will get an output of all the additions to the file between 1pm and 2pm.
The 'old' file remains...
hmm, fallen at about the second hurdle..
echo test > test
tail -1 test | grep test
returns: test
tail -1 /var/log/syslog | grep /var/log/syslog
Mostly because i didnt know how to do what you describe :oops::oops:
however i find what you put really interesting and i'll have a stab at getting it working :)
Me again! i'm using diff to compare two files, output the differences to a third file and work from that.
file1 = original file (syslog in this case)
file2 = last view of original file
My...
ahh, thank-you very much - you learn something new every day..
why does this work
sed -e 's/.*Jun 19//' myfile
And this not
mmm=Jun
dd=19
sed -e 's/.*$mmm $dd//' myfile
Thanks for the info, makes total sense, and could prove very useful in some other things i'm trying to do - cheers :)
Hi, HELP!
i have a file i'd like to shrink in size a little, and as the date appears twice, i've decided thats a good start.
the file appears as:
< Jun 17 00:00:00 - some data
I'm using...