![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Checking for a file in file pattern before deleting it | dsrookie | UNIX for Dummies Questions & Answers | 1 | 05-09-2008 05:29 PM |
| Command used for checking space occupied by files & sub-direc's inside a mount in %? | weblogicsupport | SUN Solaris | 2 | 02-01-2008 07:00 AM |
| Error checking a file from previous file size | stuck1 | Shell Programming and Scripting | 2 | 12-06-2007 08:39 AM |
| log file checking | mpang_ | Shell Programming and Scripting | 1 | 05-02-2006 03:04 AM |
| Checking file size | jkuchar747 | UNIX for Dummies Questions & Answers | 2 | 03-02-2005 02:34 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
checking for a space in a file name
hi members...
another new probs... i need to check all the zip files in the server and check for a space or "`" in the file name and if found need to remove them and form a zip file. i tried using grep command to check for a space but with out success also when i tried checking for "`" as its a special character its not recognisable in the script .. so need to have escape sequence i suppose .. i need help to come out of this please help |
|
||||
|
Code:
while read file do #Following would have the clean name without such chars #newfile=`echo "$file" | sed "s/[ \`]//g"` mv $file `echo "$file" | sed "s/[ \`]//g"` done < list_of_filenames_with_such_chars |
|
||||
|
Quote:
![]() File with spaces and ` character are suppressed and the old file is renamed to new file |
|
||||
|
checking spaces
hi matrix
here is the file name 3`_1_01_au.zip and the code ls *.zip | while read file do echo $file echo "$file" | sed "s/[ \`]//g" mv $file `"$file" | sed "s/[ \`]//g"` done error : mv: missing file argument and unexpected EOF while looking for matching ``' ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|