Search Results

Search: Posts Made By: tret
3,036
Posted By tret
use sed to remove year from string?
Hi guys,

I have been trying to play with sed to accomplish this but I just can't quite get it right.

I need to be able to remove the year from a string held in a variable in my bash script.
...
111,532
Posted By tret
I actually JUST tried this as a guess and it...
I actually JUST tried this as a guess and it worked. Can you tell me what difference there is between the single quotes and double quotes that fixes this?

Thanks,
Rob
111,532
Posted By tret
Ok so the following works...... almost ...
Ok so the following works...... almost


cat sample.txt | sed -e 's/abc/xyz/' >> result.txt


The only problem is, I want to use variables instead of abc and xyz

so something like

...
111,532
Posted By tret
Found this on another forum in case anyone is...
Found this on another forum in case anyone is interested, seems straight forward enough.
111,532
Posted By tret
Replace string in a file w/ a variable value
I am trying to replace the default home page for several mac user accounts, I wrote a script that will hunt the files down and replace them with a pre-configured set. The problem I am having is that...
18,101
Posted By tret
yeah I tried that actually because it wouldn't...
yeah I tried that actually because it wouldn't run with the \; initially. I got the same results as described above though. I think it has to do with the way find doesn't exit until it has finished...
4,264
Posted By tret
Very nice, works well. Can you do me a huge favor...
Very nice, works well. Can you do me a huge favor and break down the sed command you used here and why it works the way it does... I am still trying to figure out how to properly use it and I learn...
4,264
Posted By tret
need sed command to read a path and set to variable
I have a variable called PATH that contains a path
example: /Users/rtipton/Desktop/testusers/test

I need a sed command to set a variable called USER to the last directory name in that path
...
18,101
Posted By tret
It looks like I'll be able to adapt to work...
It looks like I'll be able to adapt to work within the piped loop without need for the data later in the script, thanks for your help!!

-Rob
18,101
Posted By tret
Hey thanks again, this worked to make the data...
Hey thanks again, this worked to make the data global but now with this option, find provides all the paths into 1 variable instead of each path being it's own value in the array.

PATH_RESULTS...
18,101
Posted By tret
Ok I tried this out but once the find + loop is...
Ok I tried this out but once the find + loop is finished the array is lost and the values are gone, I need to be able to work with the data in the array later on and outside of the loop. Any way to...
18,101
Posted By tret
Results of "find" to an array
I am looking to search a directory for a folder or file and when it finds any hits I want it to store those hits in an array so I can work with those hits later on.

I have been trying to do...
1,581
Posted By tret
remove directory x seconds after script completes
Hi guys,

I am working with a script within a Mac OS X package installer. The package installer will run the bash script once the files have been copied/installed. I have a little trouble with the...
5,095
Posted By tret
Hey danmero this works really well thanks! I...
Hey danmero this works really well thanks! I played around with it and it only takes the SeriesID if the SeriesName matches. Very cool

Is there any way to modify this so it isn't case sensitve? I...
7,937
Posted By tret
This one works well, thanks everyone for your...
This one works well, thanks everyone for your help!
7,937
Posted By tret
Remove / at the end of a string if it exists
Hey guys, Can sed or another command be used to examine a path such as
/home/test/blah/blahand check to see if the last character is a "/" and if so remove it


So this is what should happen:
...
40,004
Posted By tret
Hey cfa! string=${string// /%20}This ended...
Hey cfa!

string=${string// /%20}This ended up working in Mac OS X but not in ubuntu hardy, I was getting an error so I ended up using vid's solution:

series_name=`echo "$series_name"|sed 's/...
5,095
Posted By tret
Hey vid! Ok so I'm not sure why but this...
Hey vid!

Ok so I'm not sure why but this worked just fine on a mac os x machine but when I used the exact same thing on a linux box it just gives me a blank output, i duplicated everything...
5,313
Posted By tret
cfa! this works brilliantly, can you give me a...
cfa! this works brilliantly, can you give me a quick rundown of what you did here, I am interested in how this works
5,313
Posted By tret
hey vid the only part that will always...
hey vid

the only part that will always remain the same is
/home/xbmc/sab_downloads/video/tvafter that the path changes, the first dir after "tv" is what I want to save to a variable


So if I...
5,313
Posted By tret
dirname, save cut portion to variable, clean up
Hi guys, last cry for help for today. I appreciate the help so far.

ok so I have a program that dumps a path into my script as a variable ($1)
This path is an example...
40,004
Posted By tret
Nice this works as well. Too many good options...
Nice this works as well. Too many good options here! You guys are good, thanks again!

Rob
40,004
Posted By tret
Hey thanks cfajohnson, that did the trick, the...
Hey thanks cfajohnson, that did the trick, the second suggestion works perfectly!

Thanks again for being so helpful guys, I really appreciate it.
40,004
Posted By tret
this is a sample of the code I have to get the...
this is a sample of the code I have to get the file "GetSeries.php.xml" from thetvdb.com


series_name="green hornet"

curl -s -o /Users/rtipton/Desktop/GetSeries.php.xml...
5,095
Posted By tret
This did the trick, thanks again Vid!!! I really...
This did the trick, thanks again Vid!!! I really need to learn how to use sed!

Thanks
Showing results 1 to 25 of 29

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