LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-25-2009, 11:20 PM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
strange output of regex


Hi all...

Code:
[vinay@TEG test]$ echo grapes>"text sample2"
[vinay@TEG test]$ cat "`ls text*le2`"
grapes
[vinay@TEG test]$ cat "`ls text*2`"
cat: text2
text sample2: No such file or directory
Here I feel 3rd command should display contents of file "text sample2"...The output is really looking strange...How is this working ?
 
Old 11-25-2009, 11:27 PM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by vinaytp View Post
Hi all...

Code:
[vinay@TEG test]$ echo grapes>"text sample2"
[vinay@TEG test]$ cat "`ls text*le2`"
grapes
[vinay@TEG test]$ cat "`ls text*2`"
cat: text2
text sample2: No such file or directory
Here I feel 3rd command should display contents of file "text sample2"...The output is really looking strange...How is this working ?
I got the concept.....
shell is giving the cat command a single parameter text2..
 
Old 11-25-2009, 11:29 PM   #3
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
Code:
web31337@srvr:/tmp$ echo grapes>"text sample2"
web31337@srvr:/tmp$ cat "`ls text*le2`"
grapes
web31337@srvr:/tmp$ cat "`ls text*2`"
grapes
it works fine for me. works on debian lenny (2.6) and even on my freebsd vds.
i simply copypasted these commands from your code.
 
Old 11-26-2009, 04:39 AM   #4
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by Web31337 View Post
Code:
web31337@srvr:/tmp$ echo grapes>"text sample2"
web31337@srvr:/tmp$ cat "`ls text*le2`"
grapes
web31337@srvr:/tmp$ cat "`ls text*2`"
grapes
it works fine for me. works on debian lenny (2.6) and even on my freebsd vds.
i simply copypasted these commands from your code.
Hi web31337...
Code:
touch text2
Can you pls now execute those commands....
 
Old 11-26-2009, 04:54 AM   #5
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
mhm i get it.
cat text*2 is what you need.
 
  


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
How to capture this output with perl regex WindowBreaker Programming 8 07-08-2008 09:30 PM
regex with sed to process file, need help on regex dwynter Linux - Newbie 5 08-31-2007 05:10 AM
strange df output James Miller Slackware 9 04-16-2007 12:41 AM
strange output (c) linuxi Programming 6 11-19-2006 10:43 AM
strange ps -ax output debyani Linux - Security 1 10-27-2006 08:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:23 AM.

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
Open Source Consulting | Domain Registration