I would appreciate if someone could help me with SED syntax for a "simple" line.
Here is where I Got to:
I have these strings that are returned by my(Examples) (naturally "FullPath" is always changing don't hardcode this lol)
FullPath/AAA.framework
FullPath/BBB.framework
FullPath/CCC.framework
FullPath/DDD.framework
That I want to convert to
FullPath/AAA.framework/Versions/5/AAA
FullPath/BBB.framework/Versions/5/BBB
FullPath/CCC.framework/Versions/5/CCC
FullPath/DDD.framework/Versions/5/DDD
So basically I want to seach for "anything" after a slash up to the dot and "extract it" to copy it to the end of the string.
I'm banging my head but here is where I got to (feel like I'm near a solution)
Any help would be really appreciated
You haven't said what OS you're using. The script in2nix4life supplied will work on some systems, but the -r option is not available in all versions of sed. With a standards-conforming sed, the following should work:
Indeed, the -r wasn't available to me (on Mac OsX). Didn't know there were difference, sorry for not posting the OS.
I tried the second solution and it worked for me. Someone else gave me this solution which also worked, not sure which one is better and why but will post in case it help someone.
I prefered the one from Don Cragun as it seem neater and shorter.
I have some text like
EU1BTDAT:ASSGNDD filename='$SEQFILES/SUNIA.PJ008202.CARDLIB/DATECARD'
EU1BTDATEST:ASSGNDD filename='$SEQFILES/SUNIA.PJ008202.CARDLIB/DATECARD'
EU1CLOSEDATES:ASSGNDD filename='$SEQFILES/SUNIA.PJ008202.CARDLIB/DATECARD'
EU1DATED:ASSGNDD... (8 Replies)
I am learning SED and just following the shell scripting book, i have trouble understanding the grep and sed statement,
Question : 1
__________
/opt/oracle/work/antony>cat teledir.txt
jai sharma 25853670
chanchal singhvi 9831545629
anil aggarwal 9830263298
shyam saksena 23217847
lalit... (7 Replies)
Hello to all,
I have this sed script that replaces hex strins within a binary file.
As you can see, I want to replace all bytes 4X with 2X (where X could take values 0 to F).
sed -e 's/\x40/\x20/g' -e 's/\x41/\x21/g' -e 's/\x42/\x22/g' -e 's/\x43/\x23/g' -e 's/\x44/\x24/g' -e... (7 Replies)
Hi,
I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :-
./sample.sh: line... (12 Replies)
Hello everybody,
May you help with this, I don't know what is wrong.
I want trying to print the first 4 characters as decimal and remove the "k's" from the next 7 characters.
I'm trying with gsub and backrefence as shown below trying to remove the "k's" and then trying to assign to "x" the... (0 Replies)
Hello, I want to rename multiple files and catch some points about backreference within sed and regex.
Here is a part of my file list. Input:
S92A.fa
S92B.fa
...
S96Z.fa
S921.fa
S922.fa
...
S997.fa Note: The file names are not necessarily continuous from A~Z or 921 ~ 997, as some of the... (3 Replies)
Hello,
I'm working on learning regular expressions and what I can do with them. I'm using unix to and its programs to experiment and learn what my limitations are with them.
I'm working on duplicating the regular expression:
^(.*)(\r?\n\1)+$
This is supposed to delete duplicate lines... (2 Replies)
Hello and thx for reading this
I'm using sed to remove only the leading spaces in a file
bash-280R# cat foofile
some text
some text
some text
some text
some text
bash-280R#
bash-280R# sed 's/^ *//' foofile > foofile.use
bash-280R# cat foofile.use
some text
some text
some text... (6 Replies)
My egrep outputs this:
$ cat html.out|sed -n '/bluetext/s/ / /gp'|egrep '{5}'
<span class="bluetext"><b> Lexington Park, MD 20653</b></span>
But my backreference \1 is empty. I dont understand why. Can someone clarify?
$ cat html.out|sed -n '/bluetext/s/ / /gp'|sed -n... (1 Reply)