[SunHELP] dirname command pipe failure

Jopson, Andy Andrew.Jopson at Rolls-Royce.com
Thu Jun 24 07:43:05 CDT 2004


Oh yeah. 
Kool, it does work. I'll probably need to buy a book to understand the
syntax though! 
Cheers,
 
____________________________________________
Andrew Jopson C.Eng MSc 
Thermotek Ltd
Thermal Analyst
Rolls-Royce Thermofluids
Sinfin, Derby (PCF-2)
 
Tel: +44 (0) (1332 2) 43487
Fax: +44 (0) (1332 2) 61319
Mobi: +44 (0) 7887 948971
Email: Andrew.Jopson at Rolls-Royce.com


-----Original Message-----
From: DAUBIGNE Sebastien - BOR
[mailto:sebastien.daubigne at atosorigin.com]
Sent: 24 June 2004 12:49
To: The SunHELP List
Subject: RE: [SunHELP] dirname command pipe failure


Just give it a try :

> echo "my.file.with.lot.of.dots.before.extension" |sed
's/\(.*\)\.[^.]*$/\1/g'
my.file.with.lot.of.dots.before


--
Sebastien DAUBIGNE
Sebastien.daubigne at atosorigin.com <mailto:Sebastien.daubigne at atosorigin.com>
+33(0)5.57.26.56.36
AtosOrigin - ERP/Pessac


-----Message d'origine-----
De:	sunhelp-bounces at sunhelp.org [SMTP:sunhelp-bounces at sunhelp.org] @ la
place de Jopson, Andy
Date:	jeudi 24 juin 2004 10:49
@:	'The SunHELP List'
Objet:	RE: [SunHELP] dirname command pipe failure

Thought so, thanks for confirming that.

I don't know the sed command, so will this pipe take the extension off the
filename even if it contains .'s?


____________________________________________
Andrew Jopson C.Eng MSc
Thermotek Ltd
Thermal Analyst
Rolls-Royce Thermofluids
Sinfin, Derby (PCF-2)

Tel: +44 (0) (1332 2) 43487
Fax: +44 (0) (1332 2) 61319
Mobi: +44 (0) 7887 948971
Email: Andrew.Jopson at Rolls-Royce.com


-----Original Message-----
From: DAUBIGNE Sebastien - BOR
[mailto:sebastien.daubigne at atosorigin.com]
Sent: 24 June 2004 09:47
To: The SunHELP List
Subject: RE: [SunHELP] dirname command pipe failure


'dirname' will not read standard input, it justs takes args on the command
line.

Try this :

echo $1 | sed 's/\(.*\)\.[^.]*$/\1/g'


--
Sebastien DAUBIGNE
Sebastien.daubigne at atosorigin.com <mailto:Sebastien.daubigne at atosorigin.com>
+33(0)5.57.26.56.36
AtosOrigin - ERP/Pessac


-----Message d'origine-----
De:	sunhelp-bounces at sunhelp.org [SMTP:sunhelp-bounces at sunhelp.org] @ la
place de Jopson, Andy
Date:	jeudi 24 juin 2004 10:13
@:	'The SunHELP List'
Objet:	[SunHELP] dirname command pipe failure

Does anybody know why I can't write the following code as a pipe?

	temp=`echo $1 | tr '.' '/'`
	temp=`dirname $temp`
	echo $temp | tr '/' '.'

Like this:  echo $1 | tr '.' '/'` | dirname | tr '/' '.'

It just returns a . rather than the body of a filename (I wrote the code to
get whatever comes before the final dot in a filename i.e. it separates the
filename from it's extension). It appears that dirname (or basename for that
matter) doesn't function in a pipe command.

Thanks,
____________________________________________
Andrew Jopson C.Eng MSc
Thermotek Ltd
Thermal Analyst
Rolls-Royce Thermofluids
Sinfin, Derby (PCF-2)

Tel: +44 (0) (1332 2) 43487
Fax: +44 (0) (1332 2) 61319
Mobi: +44 (0) 7887 948971
Email: Andrew.Jopson at Rolls-Royce.com


The data contained in, or attached to, this e-mail, may contain confidential
information. If you have received it in error you should notify the sender
immediately by reply e-mail, delete the message from your system and contact
+44(0)1332 242424 (the Rolls-Royce IT Security Director) if you need
assistance. Please do not copy it for any purpose, or disclose its contents
to any other person.

An e-mail response to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.

(c) 2004 Rolls-Royce Group plc

Registered office: 65 Buckingham Gate, London SW1E 6AT
Company number: 1003142. Registered in England.
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp


The data contained in, or attached to, this e-mail, may contain confidential
information. If you have received it in error you should notify the sender
immediately by reply e-mail, delete the message from your system and contact
+44(0)1332 242424 (the Rolls-Royce IT Security Director) if you need
assistance. Please do not copy it for any purpose, or disclose its contents
to any other person.

An e-mail response to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.

(c) 2004 Rolls-Royce Group plc

Registered office: 65 Buckingham Gate, London SW1E 6AT
Company number: 1003142. Registered in England.
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
_______________________________________________
SunHELP maillist  -  SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp


The data contained in, or attached to, this e-mail, may contain confidential
information. If you have received it in error you should notify the sender
immediately by reply e-mail, delete the message from your system and contact
+44(0)1332 242424 (the Rolls-Royce IT Security Director) if you need
assistance. Please do not copy it for any purpose, or disclose its contents
to any other person.

An e-mail response to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.

(c) 2004 Rolls-Royce Group plc

Registered office: 65 Buckingham Gate, London SW1E 6AT
Company number: 1003142. Registered in England.



More information about the SunHELP mailing list