I have a file with a list of about 2500 lines that I'd like to reformat using some regex in notepad++ or sed from my box (FreeBSD 6.3-RELEASE i386) to do the following:
convert from: convert it into:
Could someone help me with this please?
Thanks Ken but I think I oversimplified my example which is why this might not work. Totally not your fault but also, I think you missed that I wanted to throw those characters into a variable and use sed again to append it to my command like so...
Eventually I want to convert it into a script #!/bin/sh and this is why additionally, I wanted to terminate each line (not sure if it's even necessary though). I have two of my own scripts that I made waaaay long ago that'll get the same job done...
-except.. I need to somehow have the characters thrown into a variable somehow to use sed again to append it as part of the command. I think the best way to do this is to have a sed sequence that works to do this then loop it through the file. Heck with that, given that a smaller test batch works, I can throw my command into the loop to get it all done under one script instead of two.
I'm still learning but what I think is relevant for all to know is that the characters after .html will be alphanumeric ([a-zA-Z0-9_] or \w) as I understand.
-----------------------------------------
What the heck.. here is the below so that all may follow what I'm trying to do...
Is it possible to manipulate the ampersand in sed? I want to sum +1 to all numbers in a file. Example that doesn't work:sed "s/\{1,2\}/$(expr & + 1)/g" filenameAlso, how to return 02 instead of 2 from expr? (8 Replies)
Hello,
I would like to remove the first column of lines beginning by a character (in my case is an open square bracket) and finishing by a space (or any other delimiter).
For example:
string1 string2 string3
to
string2 string3
I found this previous topic:
... (1 Reply)
Can we use a here document inside a here document?
Something like this
ssh user@remotehost << REMOTE
sudo vserver vsernamename enter << VSERVER
perform actions on vserver.
VSERVER
REMOTE (6 Replies)
Hey All,
I need to reorganize a file's text. Here is the source:
host John_Doe
filename "config.cfg";
hardware ethernet 98:10:3d:13:8f:98;
fixed-address 10.10.10.29;
}
host Jane_Doe
filename "config.cfg";
hardware ethernet 98:13:11:fd:5a:57;
fixed-address 10.10.5.24;
}
host... (2 Replies)
dear all,
on solaris10 for x86 i am trying to modify the creation date of a postscript file with sed in a csh script. sed is driving me crazy though...i think due to the spaces in the string i am trying to substitute??
part of the postscript file:
%!PS-Adobe-3.0... (3 Replies)
Hi, Im very new to the world of sed so I'm really not even sure if this is possible. What i need to do is read from a flat file and every time i see this line:
VAL=123,456
I need to change 456 to 457 for every occurence of this line in the file. The numbers 123 and 456 are different for... (6 Replies)
Hi, I have a slight problem in trying to manipulate the text within a file using the "sed" command in that the text i need changed has "/" slashes in.
I have a .sh script that scans the "/db/sybbackup/" directories for any .dmp file older than 2 days and then to >> the information to a file called... (3 Replies)
I have a list of names and email addresses, like this. The <tab> markers are actually tabs.
joe.blow <tab> joe.blow@wherever.com
tom.t.hall <tab> tom.t.hall@wherever.com
john.r.smith <tab> john.r.smith@wherever.com
sally.jones <tab> sally.jones@state.or.us
I want to parse the data so that... (3 Replies)
Hi everybody:
I have a problem. I have a output files which have this pattern:
number1
--space
block1a - 7rows/10columns/65elements
--space
block1b - 7rows/10columns/65elements
--space
block1c - 7rows/10columns/65elements
--space
number2
--space
block2a - 7rows/10columns/65elements... (0 Replies)