Sponsored Content
Top Forums Shell Programming and Scripting Problem renaming a file with single quotes Post 302353558 by dsshishya on Tuesday 15th of September 2009 03:26:37 PM
Old 09-15-2009
Problem renaming a file with single quotes

Hi,

I am trying to create a script which validates the incoming source files. The script has File name Pattern as Argument. The First part of the script validates if there are any files available

if [ -f $FILE_NAME ]
then
echo "\n Files are available to process \n"
else
echo "\n File does not exist: Process is Terminating \n"
exit 1
fi

I am receiving multiple files in the below format

'abc.def.ghi.jkl'
'abc.def.xty.xyz'
'abc.def.rew.ter'

I want to rename each of these files with out the single quotes as below

abc.def.ghi.jkl
abc.def.xty.xyz
abc.def.rew.ter

I am trying to do that using below code

for FILE_NAME in $FILE_NAME
do
mv "'$FILE_NAME'" "$FILE_NAME"

The Problem is when i am pass the argument with single quotes the mv command throws error.

I want to achieve 2 things
1.pass the argument(Filename) without the Single quotes by changing the internal code
2.Rename the files without the single quotes.

Please help.

Thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with single quotes in a string and findbug

I'm having trouble manipulating a string that contains single quotes (') in it. I'm writing a ksh script to parse in a few queries from a config file, such as this: findbug \(\(Project 'in' "Deployment,HDRCI,LHS,LSS,WUCI" '&&' Status 'in' "N" '&&' New_on 'lessthan' "070107" \)\) '&&' \(Class... (9 Replies)
Discussion started by: bob122480
9 Replies

2. Shell Programming and Scripting

Double quotes or single quotes when using ssh?

I'm not very familiar with the ssh command. When I tried to set a variable and then echo its value on a remote machine via ssh, I found a problem. For example, $ ITSME=itsme $ ssh xxx.xxxx.xxx.xxx "ITSME=itsyou; echo $ITSME" itsme $ ssh xxx.xxxx.xxx.xxx 'ITSME=itsyou; echo $ITSME' itsyou $... (3 Replies)
Discussion started by: password636
3 Replies

3. Shell Programming and Scripting

Single quotes and double quotes

Hi guys, I have a sed line in double quotes which works fine, but I want it to be in single quotes here is the sed line sed "/abc_def/s/\'.*\'/\'\${abc_def}\'/" can some one give the equivalent to the above script in single quotes Thanks a ton (5 Replies)
Discussion started by: sol_nov
5 Replies

4. Shell Programming and Scripting

problem with echo inserting single quotes

Consider the following script: #!/bin/bash exclude='Archive PST,SystemState' IFS=$"," rsyncExclusions=$(for exclude in ${exclude}; do echo -n -e --exclude=\"${exclude}\"\ ; done) unset IFS echo rsync $rsyncExclusions test rsync -avh --delete --delete-excluded "$rsyncExclusions"... (7 Replies)
Discussion started by: jelloir
7 Replies

5. UNIX for Dummies Questions & Answers

grep single quotes or double quotes

Unix superusers, I am new to unix but would like to learn more about grep. I am very familiar with regular expressions as i have used them for searching text files in windows based text editors. Since I am not very familiar with Unix, I dont understand when one should use GREP with the... (2 Replies)
Discussion started by: george_vandelet
2 Replies

6. Shell Programming and Scripting

Replace single quote with two single quotes in perl

Hi I want to replace single quote with two single quotes in a perl string. If the string is <It's Simpson's book> It should become <It''s Simpson''s book> (3 Replies)
Discussion started by: DushyantG
3 Replies

7. Shell Programming and Scripting

File renaming problem

Can someone tell me how can i remove the RPCFTP word from RPCFTPfilelist.csv file ? (4 Replies)
Discussion started by: JSKOBS
4 Replies

8. Shell Programming and Scripting

Search replace strings between single quotes in a text file

Hi There... I need to serach and replace a strings in a text file. My file has; books.amazon='Let me read' and the output needed is books.amazon=NONFOUND pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
Discussion started by: Hiano
7 Replies

9. Shell Programming and Scripting

Having a terrible problem with quotes/single quotes!

Hello. I'm trying to write a bash script that uses GNU screen and have hit a brick wall that has cost me many hours... (I'm sure it has something to do with quoting/globbing, which is why I post it here) I can make a script that does the following just fine: test.sh: #!/bin/bash # make... (2 Replies)
Discussion started by: jondecker76
2 Replies

10. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies
lmfsetup(8)						      System Manager's Manual						       lmfsetup(8)

Name
       lmfsetup - License Management Facility PAK registration script

Syntax
       /etc/lmfsetup [ template ]

Description
       The  script allows you to register data supplied by a Product Authorization Key (PAK).  The script prompts you for the data associated with
       each of the fields on a PAK.  When all the data has been entered, the License Management Facility (LMF) ensures there are  entries  against
       all  the mandatory fields, and that the Checksum validates all the license data.  If the data has been entered correctly, the PAK is regis-
       tered in the License Database.  If the data has been entered incorrectly, the appropriate error message is displayed and you are given  the
       opportunity to re-enter the data.

       The template option allows you to register license data from templates in A template containing a partially complete PAK is created by some
       products as part of their installation process.	The script only prompts you for data on the fields that are empty in the template.  If the
       script cannot find the specified template in it searches the current directory.

       The  script  is	provided as an alternative to the command.  This displays a template, which includes the fields on the PAK, and invokes an
       editor so that you can add the license data to the appropriate field.  The command also allows errors to be corrected without having to re-
       enter all the data.

See Also
       lmf(8)
       Guide to Software Licensing

																       lmfsetup(8)
All times are GMT -4. The time now is 06:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy