Sponsored Content
Top Forums Shell Programming and Scripting need a little kick with sed, got it almost but on glitch Post 302205830 by scarfake on Monday 16th of June 2008 11:37:50 AM
Old 06-16-2008
need a little kick with sed, got it almost but on glitch

hi friends.

yo i have a textfile with urlīs in it

sometimes middle in text, sometimes one url alone is a line

i append a string right behind the domain name

so that http://unix.com becomes http://unix.com.APPENDTHIS on all occasions.

i use this sed-line to achieve this:
Code:
sed -i "s/http:\/\/[a-zA-Z0-9\_\-\.]*/&.APPENDTHIS/g" FILE

now my problem is when the url contains a dash it messes up.

test input file:
Code:
http://alf.com/super.cgi
http://frederick.xoom.com/homepage/xy.htm
http://james_007.web1000.com/
http://unix-windows.com/bluescreen.txt

Code:
http://alf.com.APPENDTHIS/super.cgi
http://frederick.xoom.com.APPENDTHIS/homepage/xy.htm
http://james_007.web1000.com.APPENDTHIS/
http://unix.APPENDTHIS-windows.com/bluescreen.txt

the last url with the - dash in it messes up. it appends "APPENDTHIS" after the dash instead there where the domain-name ends.
what do i do wrong?
i tried to unescaped dash and double escaped also.

thanks for the needed kick.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Kick off Application on PC from Sun

I need to kick off an application on windows from my sun workstation. The workstation needs to know when windows application completes the job. What are the possible ways of doing it. Any ideas on how to go about doing it will be very helpful. Thxs in advance. (9 Replies)
Discussion started by: vbshuru
9 Replies

2. Ubuntu

Ubuntu costumized like OSX glitch

I have a laptop running Ubuntu Gusty. I have recently used applications such as AWN, Emerald, etc... to create a Mac OS X Leopard like environment. It works almost perfectly except for one little glitch. When I open most of my apps/windows, they all open with the top bar(with includes close,... (5 Replies)
Discussion started by: Texasone
5 Replies

3. Shell Programming and Scripting

Help with kick user in network script.

Hello ! I am new at this and could use som help with at script i want to do. I have a ubuntu server and want a script that check how long time a user has been login. If a user in the network has been login more the 10min i want the user get the messege " You have been login to long". An after... (1 Reply)
Discussion started by: smurfen
1 Replies

4. Shell Programming and Scripting

use statements and system glitch

hi, i have a perl script that runs as a cron job... Once in a while, the perl script fails with: Can't locate <module>.pm in @INC (@INC contains: .............) because one of the perl modules specified in the "use" statements is unavailable due to an NFS glitch. Is there some... (1 Reply)
Discussion started by: Andrewkl
1 Replies

5. Red Hat

how to re-create kick start bootable ISO

Hi All, I want to create kick start bootable ISO file. I have Centos 5.4 ISO and customized ks.cfg file. Now I need to recreate ISO with ks.cfg and content of existing ISO. During installation, it automatically should pick the kick start file and need to proceed with the installation. ... (0 Replies)
Discussion started by: kalpeer
0 Replies

6. Red Hat

Need Kick Start Post and Preinstallation Scripts

Hi All Rhel Admin Need a Small Help please Give me a Preinstallation Script and postinstallation script for Kickstart Preinstallation script Just Need to Partition 1 TB HDD using LVM Except Boot /boot = 500 swap = 16 GB / = 850 Gb 8e And need to format it in ext4 ... (1 Reply)
Discussion started by: babinlonston
1 Replies

7. UNIX for Dummies Questions & Answers

Need cronjob to kick at a specific time

Hi, I need to schedule a cronjob to kick start @ 8:30 PM server time and run every 5 mins there upon till I force stop it. Can you please let me know how can it be achieved ? (5 Replies)
Discussion started by: mohtashims
5 Replies

8. Shell Programming and Scripting

Crontab does not kick at the given time

I have crontab set to be triggered daily @ 8 am and 8:20 am server time. 00 08 * * * /web/scripts/check.sh 20 08 * * * /web/scripts/check.shuname -a Linux mymac 3.10.0-327.36.3.el7.x86_64 #1 SMP Thu Oct 20 04:56:07 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux ls -ltr /web/scripts/check.sh... (9 Replies)
Discussion started by: mohtashims
9 Replies

9. Shell Programming and Scripting

Conditional delete -- New glitch

Hi Please dont consider this as duplicated post.. I am using below pattern to find delete files to bringdown disc size.. however how i can make sure ist going to correct folder and searching for files... while print "echo rm " LastFile correctly print files names for deletion, but when i... (7 Replies)
Discussion started by: onenessboy
7 Replies
Ns_Url(3aolserver)					   AOLserver Library Procedures 					Ns_Url(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_AbsoluteUrl, Ns_ParseUrl, Ns_RelativeUrl, Ns_SkipUrl - URL manipulation routines SYNOPSIS
#include "ns.h" int Ns_AbsoluteUrl(Ns_DString *pds, char *url, char *baseurl) int Ns_ParseUrl(char *url, char **pprotocol, char **phost, char **pport, char **ppath, char **ptail) char * Ns_RelativeUrl(char *url, char *location) char * Ns_SkipUrl(Ns_Request *request, int n) _________________________________________________________________ DESCRIPTION
Ns_AbsoluteUrl(pds, url, baseurl) Construct an URL based on baseurl but with as many parts of the incomplete url as possible. Return NS_OK or NS_ERROR. Ns_ParseUrl(url, pprotocol, phost, pport, ppath, ptail) Parse a URL into its component parts. Pointers to the protocol, host, port, path, and "tail" (last path element) will be set by ref- erence in the passed-in pointers. The passed-in url will be modified. Ns_RelativeUrl(url, location) If the url passed in is for this server, then the initial part of the URL is stripped off. e.g., on a server whose location is http://www.foo.com, Ns_RelativeUrl of "http://www.foo.com/hello" will return "/hello". Returns a pointer to the beginning of the relative url in the passed-in url, or NULL if error. Will set errno on error. Ns_SkipUrl(request, n) Return a pointer n elements into the request's url. SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_Url(3aolserver)
All times are GMT -4. The time now is 02:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy