Sponsored Content
Top Forums UNIX for Dummies Questions & Answers remove pound sign from filename Post 15381 by Perderabo on Wednesday 13th of February 2002 01:16:44 PM
Old 02-13-2002
Try this script:
Code:
#! /usr/bin/ksh
for file in \#* ; do
     new=${file###}
     if [[ -f $new ]] ; then
         echo $new already exists
     else
         echo mv $file $new
         mv $file $new
     fi
done
exit 0

 

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. Shell Programming and Scripting

Sign on/Sign off logging script

I'd like to make a script that I can execute every time I sign on to my linux box that keeps track of the time and allows to me to add a remark to a file. So basically once I log in, I run the script, and it outputs the date and time to a text file (log.txt). But that isn't my problem. I need... (1 Reply)
Discussion started by: Glider
1 Replies

3. SCO

Printing Sterling Pound Sign

We need to print the sterling pound sign on printers connected directly to a terminal and configured using the /dev/null device. We have used mapchan to enable this on the printers connected directly to the SCO server. Any idea how this can be activated? OS: SCO Open Server 5.0.5 (5 Replies)
Discussion started by: nyasai
5 Replies

4. Solaris

Printing pound sign from Solaris (JETDIRECT)

Hi, Any ideas of the character sequence to print the £ sign from Solaris using network printing over Jetdirect software ? Thanks Matt (1 Reply)
Discussion started by: mattpar75
1 Replies

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

6. Shell Programming and Scripting

Remove # sign from the file

Hello Friends, i need help to remove "#" sign from a file. I want to remove the "#" marks just in the area mentioned in red. I am not so good in awk, this help would be deeply appreciated. thanks Ado trap = { # { # trap-community = SNMP-trap # hosts = hubble,... (14 Replies)
Discussion started by: asirohi
14 Replies

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

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

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 spaces in filename

Hi team, Here's a requirement for me. Here are the list of files i have in a unix directory. W 2 A D_2014.csv W 3 A D_2014.csv W 4 A D_2014.csv /home/kmani00-> uname -a AIX sliyyvxx 1 6 00F613E54C00 /home/kmani00-> The file names has to be without spaces as follows. W2AD_2014.csv... (1 Reply)
Discussion started by: kmanivan82
1 Replies
ns_file(3aolserver)					    AOLserver Built-In Commands 				       ns_file(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
ns_chmod, ns_cp, ns_cpfp, ns_ftruncate, ns_link, ns_mkdir, ns_rename, ns_rmdir, ns_symlink, ns_truncate, ns_unlink - File manipulation com- mands SYNOPSIS
ns_chmod option ?arg arg ...? ns_cp option ?arg arg ...? ns_cpfp option ?arg arg ...? ns_ftruncate option ?arg arg ...? ns_link option ?arg arg ...? ns_mkdir option ?arg arg ...? ns_rename option ?arg arg ...? ns_rmdir option ?arg arg ...? ns_symlink option ?arg arg ...? ns_truncate option ?arg arg ...? ns_unlink option ?arg arg ...? _________________________________________________________________ DESCRIPTION
ns_chmod filename mode Change a file's access permissions. ns_chmod changes the specified file's permissions to mode, in the same manner as the Unix chmod(1) command-line utility. ns_cp -preserve file1 file2 Copy one file to another. ns_cp copies the contents of file1 to file2, just like the Unix "cp" command. The default directory is the home directory for the server. If -preserve is specified, the copied file will retain the creation time, modification time, owner, and mode of the original file, just like the Unix "cp -p" command. ns_cpfp fileid1 fileid2 ?nbytes? Copy a specified number of bytes from one file to another. ns_cpfp copies information from one file (fileid1) to another (fileid2). If you specify a number of bytes in the nbytes argument, only the specified number of bytes will be copied. By default, the entire file is copied. ns_ftruncate fileid ?length? Truncate an open file to a specified length. ns_ftruncate causes the open file specified by fileid to have a size of length bytes. If length is not specified, it causes the file to have a size of zero bytes. The file must be open and be a regular file. ns_link ?-nocomplain? filename1 filename2 Create a link. ns_link creates a link named filename2 that points to the file specified by filename1. If the link fails, a Tcl error is generated, unless -nocomplain is specified. ns_mkdir path Create a directory. ns_mkdir creates the directory named PATH, just like the Unix mkdir command. By default, under Unix the direc- tory is created with the file permissions set to 0755 (rwxr-xr-x.). These permissions can be modified by setting the umask parameter for the server. ns_rename file1 file2 Rename a file. ns_rename renames the first file (file1) to the file name specified by file2. Make sure that the files and the directories in which the files exist are read/write accessible to the username that's running the AOLserver. ns_rmdir path Remove a directory. ns_rmdir removes the directory named path, just like the Unix rmdir command. The directory must already be empty. ns_unlink [-nocomplain] filename Remove a file. ns_unlink attempts to remove the file filename. If -nocomplain is not passed in and the removal fails, a Tcl error is generated. ns_truncate filename ?length? Truncate a file to a specified length. ns_truncate causes the file specified by filename to have a size of length bytes. If length is not specified, it causes filename to have a size of zero bytes. The file must exist and be a regular file. ns_unlink [-nocomplain] filename Remove a file. ns_unlink attempts to remove the file filename. If -nocomplain is not passed in and the removal fails, a Tcl error is generated. SEE ALSO
ns_chmod, ns_cp, ns_cpfp, ns_ftruncate, ns_link, ns_mkdir, ns_rename, ns_rmdir, ns_symlink, ns_truncate, ns_unlink KEYWORDS
AOLserver 4.0 ns_file(3aolserver)
All times are GMT -4. The time now is 02:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy