Search Results

Search: Posts Made By: digitalviking
1,240
Posted By digitalviking
Whats confusing
config called config.txt file contains var1=test1 var2=test2 shell script contains . contfig.txt it this right?
1,240
Posted By digitalviking
Still can't work it out
Could you explain in more detail. Cheers
1,240
Posted By digitalviking
getting vars from external files
Hi I have an issue, I want to get variables from an external file. Variable file var1=test var2-test2 I want to get these vars from another shell script. Does any one know how?
904
Posted By digitalviking
sed issue
I can't get this code to work, could I get some help...



sed -i '' "s:${shLogpath1}${cell}:${shLogpath2}${cell}:g" test.txt


Any Ideas, I think I need to separate the variables some how?
1,002
Posted By digitalviking
You sed it! ---------- Post updated at 06:35...
You sed it!

---------- Post updated at 06:35 PM ---------- Previous update was at 06:07 PM ----------

Now this an't working!


plistFn1=test1
plistFn2=test2

sed -i ''...
1,002
Posted By digitalviking
I'm a muppet! ---------- Post updated at...
I'm a muppet!

---------- Post updated at 05:59 PM ---------- Previous update was at 05:57 PM ----------

Ahhhhh

but what if you have a variable in there, like this


sed -i...
1,002
Posted By digitalviking
I sed its not working!
sed -i '' 's:'<string>/Users/testuser/Desktop/test.sh</string>':'something':g' log.txt


The log file has this in

<string>/Users/testuser/Desktop/test.sh</string> and I want to change it to...
1,709
Posted By digitalviking
What if it was the second line in the text file...
What if it was the second line in the text file is that 2?
1,709
Posted By digitalviking
Grabbing top line of text in a file and setting it to a variable
If I have a txt file with

test.txt

somelineoftext


and I want to set that line of text to variable in a script:

so

#!/bin/bash
var=''


becomes

#!/bin/bash
var='somelineoftext'
1,804
Posted By digitalviking
Random variables
I need to create a random String to save in a variable.


var=`??????`


So I want to replace ?????? with random 8 chars for instance:

is96789h

only letters and numbers

Is there an...
6,225
Posted By digitalviking
It works cool!
It works cool!
6,225
Posted By digitalviking
thanks that works great even with variable in! ...
thanks that works great even with variable in!

Cheers
6,225
Posted By digitalviking
sed -e 's:www.test.com:www.test1.com:g' -e...
sed -e 's:www.test.com:www.test1.com:g' -e 's:test.com:New website is test1.com:g' infile


Is that right surly it should be???? Will it still work? I changed s:test.com to s:test1.com and infile...
6,225
Posted By digitalviking
what if the the line was <html><body><a...
what if the the line was

<html><body><a href="http://www.test.com">test.com</a></body></html>

and I wanted to change it too


<html><body><a href="http://www.test1.com">New website is...
6,225
Posted By digitalviking
Replacing a line in a file using sed
I have a file which has a list in it

pop
triangle
people
slow
fast

What I want to do is search this list and replace people with humans do the list looks like this:

pop
triangle
human...
1,452
Posted By digitalviking
LaunchAgent file path issue
This is weirdly a linux question I suppose.

Im having a problem with this code the file path is fine if I don't use the ~ and put in the user /Users/tempuser/....

This will be installed on...
980
Posted By digitalviking
I still can't get it to work the code now is ...
I still can't get it to work the code now is

printf "%s\n" "path=`find "$dir" -maxdepth 1 -mindepth 1 -type d | while read line;do echo $RANDOM'|'$line;done |sort|cut -d"|" -f2- | head -1`" >...
897
Posted By digitalviking
passing data to another file on mac
#!/bin/bash

dir=/testdir

cat > testfile.sh << EOFILE
#!/bin/bash

path=`find "$dir" -maxdepth 100 -mindepth 1 -type d | while read line;do echo $RANDOM'|'$line;done |sort|cut -d"|" -f2- |...
12,878
Posted By digitalviking
It works... haha! It would be great to get...
It works... haha!

It would be great to get something a bit simpler but if it works it works!

Cheers
12,878
Posted By digitalviking
I like it! It seems a bit round the houses. ...
I like it! It seems a bit round the houses.

How would I put that into my command?


path=`find /testdir -maxdepth 1 -mindepth 1 -type d | ***Some sort of sort function*** | head -1`
12,878
Posted By digitalviking
Alternate to sort --random-sort
sort --random-sort


The full command is


path=`find /testdir -maxdepth 1 -mindepth 1 -type d | ***Some sort of sort function*** | head -1`


I have a list I want to randomly sort. It works...
1,585
Posted By digitalviking
Thanks that works
Thanks that works
1,585
Posted By digitalviking
Directories with spaces
My code


path=`find /root/folder/ -maxdepth 100 -type d | sort --random-sort | head -1`


if this returns a directory with spaces in for instance:

/root/folder/this is a folder

is there...
6,487
Posted By digitalviking
Worked it out its
find /root/folder/ -maxdepth 100 -type d

---------- Post updated at 04:41 PM ---------- Previous update was at 04:29 PM ----------

My code


path=`find /root/folder/ -maxdepth 100 -type d |...
6,487
Posted By digitalviking
Error
find /root/folder/ -maxdepth 1 type -d

I get this error

find: paths must precede expression: type
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...]...
Showing results 1 to 25 of 42

 
All times are GMT -4. The time now is 01:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy