Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Diff between grep .* file name and grep '.*' filename

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 11-19-2012
SasDutta SasDutta is offline
Registered User
 
Join Date: Jun 2007
Last Activity: 20 November 2012, 12:42 PM EST
Location: Kolkata
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Diff between grep .* file name and grep '.*' filename

Hi,

Can anyone let me know what is difference between

Code:
grep .* foo.c 

grep '.*' foo.c

I am not able to understand what is exact difference.

Thanks in advance

Last edited by jim mcnamara; 11-19-2012 at 07:11 PM..
Sponsored Links
    #2  
Old Unix and Linux 11-19-2012
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Moderator
 
Join Date: Oct 2010
Last Activity: 29 November 2016, 5:58 PM EST
Posts: 3,313
Thanks: 132
Thanked 1,122 Times in 1,045 Posts
Looks like a homework question
Sponsored Links
    #3  
Old Unix and Linux 11-19-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 6 December 2016, 10:37 PM EST
Location: NM
Posts: 10,879
Thanks: 458
Thanked 987 Times in 917 Posts
The '*' is not expanded by the shell into filenames. *,? and other characters in the shell are metacharacters, they represent something "beyond" themselves as basic characters - in this case * is a wild card for filenames.

If this is homework post any followups in the homework forum. It has different rules.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[awk] grep a part of filename as entry file makan Shell Programming and Scripting 10 09-04-2012 07:04 AM
grep exact string from files and write to filename when string present in file JC_1 Shell Programming and Scripting 4 08-06-2012 11:52 PM
serach diff filename in diff location using shell scripting Lucky123 Shell Programming and Scripting 1 11-25-2011 03:44 AM
[solved] Diff between two files by grep feelmyfrd Shell Programming and Scripting 12 08-03-2010 03:46 AM
grep for certain files using a file as input to grep and then move anita07 Shell Programming and Scripting 2 12-10-2009 04:59 AM



All times are GMT -4. The time now is 04:35 AM.