LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-15-2010, 11:02 PM   #1
madhubt
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Rep: Reputation: 0
Pattern Matching. Discrepancy across 32bit and 64bit Linux Host


Hello.

I'm encountering pattern matching discrepancy across 32bit and 64bit Linux box.Details are below:

Linux version:[64 bit] 2.6.9-68.9.ELmsdw.2smp x86_64

Linux version: [32 bit] 2.4.21-32.0.1.EL.msdwhugemem i686

Pattern to match:
ls -1 /u/Feeds/FILE.[0-9]{8}.DAT

Works perfect on 32bit but not on 64bit. Please advise.
 
Old 03-15-2010, 11:47 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Could you please provide the versions of bash ? ( 'bash --version' ) .. and also the output of 'alias' on each machine

thanks
 
Old 03-16-2010, 12:27 AM   #3
madhubt
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Please refer to below details.

32 bit:
GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.

2d='set -f;_2d'
RESET=reset
autoload='typeset -fu'
command='command '
fc=hist
float='typeset -E'
functions='typeset -f'
hash='alias -t --'
history='hist -l'
integer='typeset -i'
l.='ls -d .* --color=tty'
ll='ls -l --color=tty'
local=typeset
ls='ls --color=tty'
nameref='typeset -n'
nohup='nohup '
r='hist -s'
redirect='command exec'
stop='kill -s STOP'
suspend='echo "This is a login shell."'
times='{ { time;} 2>&1;}'
type='whence -v'
which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

64 Bit:
========
GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

alias o/p:

2d='set -f;_2d'
RESET=reset
autoload='typeset -fu'
command='command '
fc=hist
float='typeset -E'
functions='typeset -f'
hash='alias -t --'
history='hist -l'
integer='typeset -i'
l.='ls -d .* --color=tty'
ll='ls -l --color=tty'
ls='ls --color=tty'
mc='. /usr/share/mc/bin/mc-wrapper.sh'
nohup='nohup '
r='hist -s'
redirect='command exec'
source='command .'
stop='kill -s STOP'
suspend='echo "This is a login shell."'
times='{ { time;} 2>&1;}'
type='whence -v'
which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
 
Old 03-16-2010, 03:02 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Looks ok... what is the exact output of the command on each machine ?
 
Old 03-16-2010, 03:11 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
He's actually comparing bash 2.05b with bash 3.00.15 ... not that I think this
should make a difference in this particular case.


Cheers,
Tink
 
Old 03-16-2010, 07:21 AM   #6
madhubt
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Since i'm checking for the existence of file, on 32 bit it gives the file-name while on 64bit it says file not present.
 
Old 03-16-2010, 05:24 PM   #7
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Is the file actually present ? ... can you please run 'ls -1 /u/Feeds/FILE*'

<edit>On second thoughts... I don't think the 'repeat' argument is actually valid, I use it with sed or grep but it doesn't seem to work with bash... you may need to use something like :

ls -1 FILE.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].dat

I'm not sure why it would work on earlier versions of bash
</edit>

Last edited by kbp; 03-16-2010 at 05:46 PM.
 
Old 03-17-2010, 12:14 AM   #8
madhubt
LQ Newbie
 
Registered: Mar 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks to every-one on the forum for prompt feed-back. Looks like pattern matching works if i change the command to:

ls -1 /u/Feeds/FILE.{8}([0-9]).DAT
 
Old 03-17-2010, 01:29 AM   #9
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
.. strange, I'm not sure how it's working but good luck
 
Old 03-17-2010, 10:29 AM   #10
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,424

Rep: Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823Reputation: 2823
Not to be picky, BUT there is a difference between the first and the last and its not the newly added brackets ():

ls -1 /u/Feeds/FILE.[0-9]{8}.DAT (original)

ls -1 /u/Feeds/FILE.{8}([0-9]).DAT (new)

Would appear first is looking for /u/Feeds/FILE.98.DAT (for example)
but the second would be /u/Feeds/FILE.89.DAT (8 and 9 reversed)
 
Old 03-17-2010, 02:07 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Well ... I haven't laid my hands on bash 2.0x in a good while,
but the {8} just makes no sense unless you have literal curly
braces in the files names. Bash' expansion of curlies was only
introduced in version 3, but it only works if there's either
a list of comma-separated values or an ellipsis, e.g., {8,9}
or {0..2}; the former in the file-names above would expand to
FILE.[0-9]8.DAT FILE.[0-9]9.DAT, the latter to FILE.[0-9]0.DAT
FILE.[0-9]1.DAT FILE.[0-9]2.DAT ... and *if* there are literal
curly braces swapping the order would indeed make for a
completely different result, irrespective of expansion or not.



Cheers,
Tink

Last edited by Tinkster; 03-17-2010 at 02:10 PM.
 
  


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
Problem building 32bit RPM on 64bit host RattleSn@ke Linux - Software 2 09-25-2009 09:45 AM
32bit qemu image on 64bit host? Yalla-One Slackware 14 08-25-2009 06:18 PM
pattern Matching libgen on Linux ? nano2 Linux - Software 0 05-16-2008 11:18 AM
Linux/Unix script for file pattern matching varunnarang Programming 1 08-07-2006 02:14 PM
can 64bit processor run both 64bit and 32bit computers? DJOtaku Linux - General 4 09-08-2005 09:14 PM


All times are GMT -5. The time now is 11:04 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration