LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-23-2012, 12:28 PM   #1
Raakh5
Member
 
Registered: Mar 2012
Posts: 95

Rep: Reputation: Disabled
xargs: unmatched single quote; by default quotes are special to xargs unless you use


Hello,

Code:
 ls| sort -n | head -500| xargs -i echo mv "{}" /destination
Sometimes it run and some time its throwing error by stopping the operation as follow:
xargs: unmatched single quote; by default quotes are special to xargs unless you use

Please advise

Best regards
 
Old 03-23-2012, 02:24 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,973
Blog Entries: 5

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Since there is no "unmatched single quote" in the line maybe it is finding a file with a single quote as part of the name and getting confused by that?
 
Old 03-23-2012, 02:38 PM   #3
Raakh5
Member
 
Registered: Mar 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Can I fix it?
 
Old 03-23-2012, 04:29 PM   #4
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 5,973
Blog Entries: 5

Rep: Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777Reputation: 777
Did you find such a file?
 
Old 03-23-2012, 04:37 PM   #5
Raakh5
Member
 
Registered: Mar 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Hello,

There are some file names in Arabic or as a strange character e.g. د.سفيان عبد العزيز الشروف_original.doc or 52379MUHAMMADAFZALHUMAYOON_original's.doc, +++++ +++++++ ++++++_original.doc

Regards
 
Old 05-21-2014, 03:24 PM   #6
Gener@l
LQ Newbie
 
Registered: Sep 2011
Posts: 11

Rep: Reputation: Disabled
SO is there a work around for this? I am having a similar issue where a list of words returned and put into the xargs command have a ' in the middle of the word.
 
Old 05-21-2014, 06:22 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,408

Rep: Reputation: 594Reputation: 594Reputation: 594Reputation: 594Reputation: 594Reputation: 594
If there is just one delimiter character (i.e., not the default of both blank and newline), you can use the "-d delim" option, which will cause all other characters to be taken literally. See the xargs manpage for details.
 
Old 05-21-2014, 07:26 PM   #8
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,066

Rep: Reputation: Disabled
Why not use the 'mv' and 'cp' '-t' option to set the destination. Also use 'find' instead of 'ls' and use its '-print0' along with xargs '-0' option to deal with spaces and other issues.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xargs: unmatched single quote akudewan Linux - Newbie 5 07-28-2014 12:16 PM
[SOLVED] find cp xargs and error unmatched single quote; mythcat Linux - Newbie 6 01-23-2012 11:11 AM
xargs removes single quotes after awk Poki Linux - Newbie 4 06-26-2009 09:25 AM
gvim - double quote char always replaced with two single quotes in special modes JazzItSelf Linux - Software 4 09-16-2008 11:26 AM
xargs: unmatched single quote fillatre Linux - Software 2 06-05-2004 10:04 PM


All times are GMT -5. The time now is 07:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration