Sponsored Content
Top Forums Shell Programming and Scripting Replace characters in all file names in a particular directory Post 99372 by bigearsbilly on Thursday 16th of February 2006 05:00:47 PM
Old 02-16-2006
for f in bdw* ;do
echo mv $f fdm${f%bdw}
done
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Weird Ascii characters in file names

Hi. I have files in my OS that has weird file names with not-conventional ascii characters. I would like to run them but I can't refer them. I know the ascii # of the problematic characters. I can't change their name since it belongs to a 3rd party program... but I want to run it. is there... (2 Replies)
Discussion started by: yamsin789
2 Replies

2. UNIX for Dummies Questions & Answers

Listing full file names with the exact length of 3 characters

This is what I have to do: Display the full file name (including the full path) and file size of all files whose name (excluding the path) is exactly 3 characters long. This is the code I have: find / -printf "Name: %f Path: %h Size: %s (bytes)\n" 2>/dev/null | grep -E "Name: .{3,} Path" |... (7 Replies)
Discussion started by: Joesgrrrl
7 Replies

3. UNIX for Dummies Questions & Answers

removing first 7 characters of directory names

Hi, I'm relatively new to unix, and would like to change the following files in a particular directory. The files have names like: M10_90_Phcn402_3F.ab1 M10_94_Sput402_3F.ab1 M11_92_Abrg402_3R.ab1 M10_91_Cdel402_3F.ab1 M11_90_Phcn402_3R.ab1 M12_84_Sput402_3R.ab1... (4 Replies)
Discussion started by: euspilapteryx
4 Replies

4. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

5. Shell Programming and Scripting

Finding File Names Ending In 3 Random Numerical Characters

Hi, I have a series of files (upwards of 500) the filename format is as follows CC10-1234P1999.WGS84.p190 each of this files is in a directory named for the file but excluding the extension. Now the last three numeric characters, in this case 999, can be anything from 001 to 999, I need to... (3 Replies)
Discussion started by: roche.j.mike
3 Replies

6. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

7. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

8. Tips and Tutorials

How to manage file names with special characters

One of the common questions asked are: how do i remove/move/rename files with special (non-printable) characters in their name? "Special" doesn't always mean the same. As there are more and less special characters, some solutions are presented, ranging from simple to very complicated. Usually a... (0 Replies)
Discussion started by: bakunin
0 Replies

9. UNIX for Dummies Questions & Answers

[solved]removing characters from a mass of file names

I found a closed thread that helped quite a bit. I tried adding the URL, but I can't because I don't have enough points... ? Modifying the syntax to remove ! ~ find . -type f -name '*~\!]*' | while IFS= read -r; do mv -- "$REPLY" "${REPLY//~\!]}"; done These messages are... (2 Replies)
Discussion started by: rabidphilbrick
2 Replies

10. UNIX for Dummies Questions & Answers

How to remove first few characters from multiple file names without do loop?

Hi Fellows, I was wondering how I can remove first few characters from multiple file names without do loop in unix? e.g. water123.xyz water456.xyz to 123.xyz 456.xyz Thanks Paul Thanks. (3 Replies)
Discussion started by: Paul Moghadam
3 Replies
pts(7D) 							      Devices								   pts(7D)

NAME
pts - STREAMS pseudo-tty slave driver DESCRIPTION
The pseudo-tty subsystem simulates a terminal connection, where the master side represents the terminal and the slave represents the user process's special device end point. In order to use the pseudo-tty subsystem, a node for the master side driver /dev/ptmx and N nodes for the slave driver (N is determined at installation time) must be installed. The names of the slave devices are /dev/pts/M where M has the values 0 through N-1. When the master device is opened, the corresponding slave device is automatically locked out. No user may open that slave device until its permissions are adjusted and the device unlocked by calling functions grantpt(3C) and unlockpt(3C). The user can then invoke the open system call with the name that is returned by the ptsname(3C) function. See the example below. Only one open is allowed on a master device. Multiple opens are allowed on the slave device. After both the master and slave have been opened, the user has two file descriptors which are end points of a full duplex connection composed of two streams automatically connected at the master and slave drivers. The user may then push modules onto either side of the stream pair. The user needs to push the ptem(7M) and ldterm(7M) modules onto the slave side of the pseudo-terminal subsystem to get terminal semantics. The master and slave drivers pass all messages to their adjacent queues. Only the M_FLUSH needs some processing. Because the read queue of one side is connected to the write queue of the other, the FLUSHR flag is changed to the FLUSHW flag and vice versa. When the master device is closed an M_HANGUP message is sent to the slave device which will render the device unusable. The process on the slave side gets the errno EIO when attempting to write on that stream but it will be able to read any data remaining on the stream head read queue. When all the data has been read, read returns 0 indicating that the stream can no longer be used. On the last close of the slave device, a 0-length message is sent to the master device. When the application on the master side issues a read() or getmsg() and 0 is returned, the user of the master device decides whether to issue a close() that dismantles the pseudo-terminal subsystem. If the master device is not closed, the pseudo-tty subsystem will be available to another user to open the slave device. Since 0-length messages are used to indicate that the process on the slave side has closed and should be interpreted that way by the process on the master side, applications on the slave side should not write 0-length messages. If that occurs, the write returns 0, and the 0-length message is discarded by the ptem mod- ule. The standard STREAMS system calls can access the pseudo-tty devices. The slave devices support the O_NDELAY and O_NONBLOCK flags. EXAMPLES
int fdm fds; char *slavename; extern char *ptsname(); fdm = open("/dev/ptmx", O_RDWR); /* open master */ grantpt(fdm); /* change permission of slave */ unlockpt(fdm); /* unlock slave */ slavename = ptsname(fdm); /* get name of slave */ fds = open(slavename, O_RDWR); /* open slave */ ioctl(fds, I_PUSH, "ptem"); /* push ptem */ ioctl(fds, I_PUSH, "ldterm"); /* push ldterm*/ FILES
/dev/ptmx master clone device /dev/pts/M slave devices (M = 0 -> N-1) SEE ALSO
grantpt(3C), ptsname(3C), unlockpt(3C), ldterm(7M), ptm(7D), ptem(7M) STREAMS Programming Guide SunOS 5.10 21 Aug 1992 pts(7D)
All times are GMT -4. The time now is 05:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy