Sponsored Content
Full Discussion: remove filename prefix
Top Forums UNIX for Dummies Questions & Answers remove filename prefix Post 24392 by peter.herlihy on Thursday 11th of July 2002 01:08:24 AM
Old 07-11-2002
ahhhh - echo...of course...great thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove prefix from filenames

I'm trying to put together a shell script that will append specific prefixes based on the content of filenames. I think I have this part down. However, I want to append before that part a process that will remove the current prefix before it renames the files with the new prefix. For example,... (6 Replies)
Discussion started by: HLee1981
6 Replies

2. UNIX for Dummies Questions & Answers

Use same filename for prefix in the split command

I want to execute something like this: find . -type f -regex '$REGEX' -print | xargs split -d -C $SIZE The problem is that I want the name of the split files to be the same name as original files. So if my directory has two files called abc.txt and def.txt, then I want the split files to be... (1 Reply)
Discussion started by: namityadav
1 Replies

3. 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

4. Shell Programming and Scripting

Remove prefix using awk

Remove prefix using awk File: nawk -F"|" '{if ($1 ~ /^xyz./) print; else { gsub(.*\..*, \..*, $1) ;print }}' file Error: ouput required: (5 Replies)
Discussion started by: pinnacle
5 Replies

5. 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

6. Shell Programming and Scripting

Remove prefix per line in file

Hi, I'm using a .ksh script to split one file into multible files by checking for the prefix per line. It works perfekt (thanks again for anyone involved in helping me with that ;)), but I want to remove the prefix per line too. Means only the line information itself should remain in the... (7 Replies)
Discussion started by: spidermike
7 Replies

7. 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

8. Shell Programming and Scripting

remove the filename from a string

I have a string like this /Development/ST/st000001su/Outbound/Prod/PROD-732QCJ/63acf2caf91bc136cb9bcce8a85c7fa8/PGP/PGP.txt I want to remove the PGP.txt and I want only the /Development/ST/st000001su/Outbound/Prod/MCFR-732QCJ/63acf2caf91bc136cb9bcce8a85c7fa8/PGP returned. I saw an command... (2 Replies)
Discussion started by: srini0603
2 Replies

9. Shell Programming and Scripting

Using filename to determine a prefix that needs to be added to string column on file?

Possible filenames: CDD_Whatever.txt DDD_Whatever.txt If the file prefix = CDD, I'd like to prefix every person ID (second column in my examples below) on the file with "c-" If the file prefix = DDD, I'd like to prefix ever person ID with "d-" Input: Desired Output: Any help... (2 Replies)
Discussion started by: lrluis
2 Replies

10. Shell Programming and Scripting

Extract Uniq prefix from a start and end prefix

Dear All, assume i have a file with content: <Start>6000</Start> <Stop>7599</Stop> the output is: 6000 7000 7100 7200 7300 7400 7599 how should we use any awk, sed, perl can do this task, means to extract the uniq prefixes from the start and stop prefix. Thanks Jimmy (3 Replies)
Discussion started by: jimmy_y
3 Replies
mktemp(1)						      General Commands Manual							 mktemp(1)

Name
       mktemp - make a name for a temporary file

Syntax
       mktemp [ -c ] [ -d directory_name ] [ -p prefix ]

Description
       The  command makes a name for the pathname of a temporary file and writes that name to standard output. The name will not duplicate that of
       an existing file. The command does not create a new file. The file named must actually be created before can generate a new filename.

       Subsequent calls to will only generate a new file name if all previously generated file names have been	created  by  the  user	and  still
       exist.  Error messages are written to standard error.

       The  directory_name generated by is the concatenation of a directory name, a slash (/), a file prefix, a dot (.), a four digit number and a
       unique character.

       The directory name is chosen as follows:

	  (1)  If the -d option is specified, directory_name is used.

	  (2)  Otherwise, if the TMPDIR environment variable is set and a string that would yield a unique name can be obtained using the value of
	       that variable as a directory name, this value is used.

	  (3)  Otherwise, is used.

       The prefix is chosen as follows:

	  (1)  If the -p option is specified, prefix is used.

	  (2)  Otherwise, if the LOGNAME environment variable is set, it is used as the prefix.

	  (3)  Otherwise, the user's login name is used.

Options
       -c	   Causes to attempt to create a regular file using the generated (or created) name string. If file creation is successful, a zero
		   length file is created with access permissions derived from the process's file mode creation mask, see No attempt  is  made	to
		   create  a file if the length of the generated (or created) name string exceeds 1023 characters. It is the user's responsibility
		   to remove files created by use of this option.

       -d directory_name
		   Causes directory_name to be used as the directory portion of the pathname. In this case,  directory_name  is  used  instead	of
		   TMPDIR and

       -p prefix   Causes  the string prefix to be used as the file's prefix.  It is used instead of LOGNAM and the user's login name. If the pre-
		   fix is longer the 249 characters, it will be silently truncated to that length before the concatenation of the suffix.

Environmental Variables
       LOGNAME	   When the -p prefix option is not specified, the value of this variable is used as the prefix of the filename, if it exists.

       TMPDIR	   When the -d directory_name option is not specified, the value of this variable is used instead of

Restrictions
       If the user does not have write permission in the directory specified, and error message is reported and is used in its place.  The  entire
       path name can not exceed 1023 characters, and the temporary file name can not exceed 255 characters. If the generated file name is too long
       it is truncated to fit before the suffix is added.

See Also
																	 mktemp(1)
All times are GMT -4. The time now is 01:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy