Henley55 Posted April 26, 2008 Share Posted April 26, 2008 hey guys im pretty new to unix and still learning. im playing around with metacharacters. Im trying to remove special meaning of * which i thought would b \* . Im wanting to search a files contents for one or more occurences of an asterix ( * ) Any advice would help Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted April 26, 2008 Veteran Share Posted April 26, 2008 You are right. The backslash escape character for the asterisk is correct. For example: mark@mark-core2:~$ touch crazy_file mark@mark-core2:~$ mv crazy_file crazy\*file mark@mark-core2:~$ ls cra* crazy*file mark@mark-core2:~$ ls | grep \* crazy*file mark@mark-core2:~$ You can see that I can rename a file to include an asterisk. I can ls and see it. Then I can even pass an ls through a grep that pattern matches to find the asterisk. Link to comment Share on other sites More sharing options...
Barney T. Administrators Posted April 27, 2008 Administrators Share Posted April 27, 2008 Topic moved here Link to comment Share on other sites More sharing options...
Henley55 Posted April 27, 2008 Author Share Posted April 27, 2008 excellent so if i wanted to put this into a case statement that would search for a number of options, continuing with files \*) echo asterix found etc would work Link to comment Share on other sites More sharing options...
Recommended Posts