Sponsored Content
Top Forums Shell Programming and Scripting remove the filename from a string Post 302533345 by verdepollo on Thursday 23rd of June 2011 11:01:56 AM
Old 06-23-2011
Code:
dirname

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

remove filename prefix

I've got a bunch of files called oldabc, olddef etc. i want to copy these to be abc, def.... I can do this with file extensions....but can get the logic to work for prefixes. All the files I am interested in have a prefix of 'old'. This loop is no good for me....it looks at the content... (2 Replies)
Discussion started by: peter.herlihy
2 Replies

2. UNIX for Dummies Questions & Answers

Remove path from filename

In a foreach loop I end up with $file containing the filename INCLUDING the whole path. I want this reduced to just the filename, but I can't seem to remember how I did it some years back. I am sure I can do it with "sed", but I am pretty sure I have seen a simpler command. Anyone? borgeh (3 Replies)
Discussion started by: borgeh
3 Replies

3. Shell Programming and Scripting

How to remove numbers from filename

Hi all, Can I edit this script: find . -type f | while read i;do && mv "$i" "${i//abc/}" ;done so that it will not only take out abc from the filename but also take out any numbers that might be in the filename as well. An example would be, Input: filename abc 2009.mov Output:... (7 Replies)
Discussion started by: Monkey Dean
7 Replies

4. Shell Programming and Scripting

how to remove last two extensions of a filename

hi how to remove extensions of a file.. suppose i have a filename "gtk2-2.4.13-24.el4.x86_64.rpm" and i want the file name as "gtk2-2.4.13-24.el4" means want to remove last two "." extensions of a file can anyone help me in this thanks in advance srik (12 Replies)
Discussion started by: srikanthg
12 Replies

5. Shell Programming and Scripting

How to remove filename from the path

Hi, I have a list of paths with files at the end. How can strip off filenames. This is what I have: /apps/test/abc/file.txt /apps/new/home/daily/report.xml /apps/old/home/weekly/out/test.sh This is what I need: /apps/test/abc/ /apps/new/home/daily/ /apps/old/home/weekly/out/ ... (10 Replies)
Discussion started by: djanu
10 Replies

6. Linux

Find String in FileName and move the String to new File if not found

Hi all, I have a question.. Here is my requirement..I have 500 files in a path say /a/b/c I have some numbers in a file which are comma seperated...and I wanted to check if the numbers are present in the FileName in the path /a/b/c..if the number is there in the file that is fine..but if... (1 Reply)
Discussion started by: us_pokiri
1 Replies

7. Shell Programming and Scripting

Remove last character from filename

Hi All, I have different type of file (.txt,.csv,.xml) format in my current directory. My requirement is that I need to remove the last character from the file format. Example count.txt$ csp_rules.csv^ Date.xml~ Need Output: count.txt csp_rules.csv Date.xml How to do that?.... (5 Replies)
Discussion started by: suresh01_apk
5 Replies

8. Shell Programming and Scripting

grep exact string from files and write to filename when string present in file

I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Discussion started by: JC_1
4 Replies

9. Shell Programming and Scripting

How to remove sections of a filename?

Hello, I need some help with renaming some files by removing a certain portion of the filename. The current file name is: ABC_2013186197_20130708_203556.95336 I need to remove the 5 digits after the first "_". The new file name should be: ABC_197_20130708_203556.95336 I'm not quite... (5 Replies)
Discussion started by: bbbngowc
5 Replies

10. Shell Programming and Scripting

Remove the last 9 characters of a filename

Hi All! Please can someone help, I have a dir with the following files: ~-rw-r--r-- 1 emmuser users 2087361 Oct 16 15:50 MPGGSN02_20131007234519_24291.20131007 -rw-r--r-- 1 emmuser users 2086837 Oct 16 15:50 MPGGSN02_20131007233529_24272.20131007 -rw-r--r-- 1 emmuser ... (7 Replies)
Discussion started by: fretagi
7 Replies
dcut(1) 						      General Commands Manual							   dcut(1)

NAME
dcut - Debian archive .commands file upload tool SYNTAX
dcut [options] [host] [command [, command]] dcut -U filename [host] DESCRIPTION
dcut creates and / or uploads .commands files for the Debian FTP archive upload queue. It is a companion for dput and uses dput configura- tion files. As with dput, you can specify a host defined in the dput configuration file. In case your host is funnily named, i.e. it could mistaken for a command, you may also use a command line option to specify the host. In default operation mode (unless you request to upload an existing file), the host description is followed by a comma-seperated list of commands. (Semicolons also work but require shell escaping.) COMMANDS
Presently supported commands are rm, reschedule and cancel. rm can be used to remove files from the UploadQueue directories. dcut generates commands that search the subdirectories automaticall, but you can also specify --nosearchdirs and then target individual UploadQueue direc- tories, i.e. either filenames without path for regular incoming or DELAYED/#-day/filename. Wildcards are accepted. reschedule changes-file #-day can be used to move an upload from any DEFERRED queue to #-day (use 0-day for immediate processing). cancel changes-file cancels an upload from DEFERRED. Both reschedule and cancel take a complete basename of a changes file as argument and operate on the whole upload, they process the changes and all files mentioned by it. The authorative documentation for the commands interface can be found at "ftp://ftp.upload.debian.org/pub/UploadQueue/README". The options try to resemble dput's to the extent possible. Note that dcut calls debsign to sign any commands file generated. In particular, debsign does basic syntax checking on the commands you specify. OPTIONS
-c filename, --config=filename Use config file filename. -d, --debug Print debug messages. -h, --help Print help information and exit. --host=host Upload to host (as found in the dput configuration). Use this if your host is named like one of the commands. -m maintainer, --maintainer=maintainer Use maintainer (full email) for the uploader field and gpg key selection. This has no effect when --upload is used. -k keyid, --keyid=keyid Use keyid for signing. Default is to let debsign choose a keyid. This has no effect when --upload is used. -O filename, --output=filename Write commands file to filename instead of uploading. You sould not specify a host when using this option. Also, this option should not be used with --upload. Both filename and filename.asc will be overwritten. -P, --passive Use passive ftp instead of active. -s, --simulate Simulate an upload only. -U filename, --upload=filename Upload commands file. Note: No checks (syntax or presence/validity of signature) are currently performed. -i filename, --input=filename Read an input changes file to create a commands file that can remove the files listed in the .changes file from the upload queue. -v, --version Print version information and exit. ENVIRONMENT
The program uses the environment variables DEBEMAIL or EMAIL and DEBFULLNAME to populate the uploader field. Also, environment variables may be used in search of a suitable place for temporary files. EXAMPLES
To upload a GPG signed commands file that removes dput_0.9.2.33_all.deb file from the queue, one would have to do $ dcut rm dput_0.9.2.33_all.deb This creates and uploads a commands file that looks like the following: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Uploader: Foo Bar <foo@bar.org> Commands: rm dput_0.9.2.33_all.deb -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYKAkisYx0ACgkQ4eu+pS04mIfwLQCg85XVpae/LHLrbvzywcQNt9PS ztsAoMgw6HjcI9flfmwjgMiapcu379Pu =fjp0 -----END PGP SIGNATURE----- To upload a GPG signed commands file that removes files named in dput_0.9.4_i386.changes from the queue, one would have to do $ dcut --input dput_0.9.4_i386.changes This creates and uploads a commands file that looks like the following: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Uploader: Foo Bar <foo@bar.org> Commands: rm --searchdirs dput_0.9.4.dsc rm --searchdirs dput_0.9.4.tar.gz rm --searchdirs dput_0.9.4_all.deb -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYKAkisYx0ACgkQ4eu+pS04mIfwLQCg85XVpae/LHLrbvzywcQNt9PS ztsAoMgw6HjcI9flfmwjgMiapcu379Pu =fjp0 -----END PGP SIGNATURE----- If you've uploaded packages with the --delayed option (uploaded to DEFERRED queue), then use the cancel command with a .changes file. $ dcut cancel dput_0.9.4_i386.changes This creates and uploads a commands file just like the other commands. LICENSE
This program is distributed under the terms of the Gnu General Public License, Version 2 or later. BUGS
Please direct bug reports and comments to the author. Your feedback is appreciated. If you're using Debian packages, file bugs against the dput package. FILES
dcut makes use of the dput configuration files: /etc/dput.cf System dput configuration file. ~/.dput.cf User dput configuration file. Much helpful input and some stolen code from dput author Christian Kurz. SEE ALSO
dput(1), dput.cf(5) ftp://ftp.upload.debian.org/pub/UploadQueue/README AUTHOR
Thomas Viehmann <tv@beamnet.de> January 2004 dcut(1)
All times are GMT -4. The time now is 09:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy