Sponsored Content
Full Discussion: Brauche SCHNELLE HILFE
Top Forums UNIX for Dummies Questions & Answers Brauche SCHNELLE HILFE Post 302301357 by methyl on Thursday 26th of March 2009 03:55:43 PM
Old 03-26-2009
See "man basename".

Code:
basename filename .orig


For example:

Code:
ls *\.orig | while read filename
do
        new_filename=`basename "${filename}" .orig`
        # Remove echo when you are happy with result
        echo mv "${filename}" "${new_filename}"
done


Last edited by methyl; 03-26-2009 at 05:05 PM.. Reason: Add example
 

3 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Crontab Eintrag geht nicht... bitte um hilfe

Hallo, ich versuche in Crontab eine Befehlszeile einzufügen, das mein Script für ein Anti Flood Tool nach jedem neustart des Servers startet. Leider kenne ich mich Linux nicht soooo gut aus. Vielleicht kann mir jemand helfen? Ich danke euch schon mal. --> der Eintrag den ich geschrieben... (7 Replies)
Discussion started by: skimoni
7 Replies

2. Shell Programming and Scripting

Hilfe beim SCRIPT

Hallo, unter Suse Linux 11.2 / Kubuntu 10.04 habe ich mir ein Service-Menü angelegt. Bis auf das Nachfolgende funktioniert alles bestens. Bisher habe ich auf der Konsole mit dem Programm pdftk Anhänge an ein Pdf-File erzeugt. Der Code lautete pdftk beispiel.pdf attach_files Anlage1.pdf... (1 Reply)
Discussion started by: Hannes_007
1 Replies

3. OS X (Apple)

OS 10 lässt sich nicht mehr installieren...ubuntu läuft als system im moment....hilfe!

hello, I have installed on my MacBookPro Ubuntu via Boot Camp, but bootcamp has deletet that MacOS partion and created just one new and installed ubuntu. Now I can not install MacOS 10 from the DVD, the gray screen comes when I use the "C" key during the boot process. it starts booting... (2 Replies)
Discussion started by: ingwio
2 Replies
BASENAME(1)						    BSD General Commands Manual 					       BASENAME(1)

NAME
basename, dirname -- return filename or directory portion of pathname SYNOPSIS
basename string [suffix] basename [-a] [-s suffix] string [...] dirname string [...] DESCRIPTION
The basename utility deletes any prefix ending with the last slash '/' character present in string (after first stripping trailing slashes), and a suffix, if given. The suffix is not stripped if it is identical to the remaining characters in string. The resulting filename is written to the standard output. A non-existent suffix is ignored. If -a is specified, then every argument is treated as a string as if basename were invoked with just one argument. If -s is specified, then the suffix is taken as its argument, and all other arguments are treated as a string. The dirname utility deletes the filename portion, beginning with the last slash '/' character to the end of string (after first stripping trailing slashes), and writes the result to the standard output. EXIT STATUS
The basename and dirname utilities exit 0 on success, and >0 if an error occurs. EXAMPLES
The following line sets the shell variable FOO to /usr/bin. FOO=`dirname /usr/bin/trail` SEE ALSO
csh(1), sh(1), basename(3), dirname(3) STANDARDS
The basename and dirname utilities are expected to be IEEE Std 1003.2 (``POSIX.2'') compatible. BSD
April 18, 1994 BSD
All times are GMT -4. The time now is 10:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy