Re: Bash: Asterisk reading problem



Pan wrote:
Hi everybody

I've been having significant problems trying to read the asterisk
character from a set of data files. I have a task of parsing a large
number of HTML files and then exporting the required text information to
independent files. I had some initial problems at this, but it's working
pretty well now. However, I've noticed that a rare number of files contain
the asterisk symbol, which is causing problems with the exporting process.
The problem begins when I read an interpretation of the HTML page into a
Bash variable. The asterisk symbol in the variable is substituted into a
list of all files in the current directory, which is not the desired
behaviour :) I simply want the asterisk symbol exported instead.

I have fiddled around with various ideas to fix it without success. It was
fairly easy to convert it to another symbol which resolves the problem,
but I would prefer to keep the asterisk characters if at all possible. But
nothing I've tried seems to change the situation and I always seem to get
the substituted file list inside the Bash variable and therefore in the
exported data.

I've run into a wall at this stage. Does anybody have any idea how I could
fix this?

Thanks

Regards,

Pan
Without seeing your script its difficult to say precisely but it sounds like its probably a quoting problem.

The "*" is a filename wildcard to bash - hence the substitution. You will also run into similar problems with other shell metacharacters, ()?[]$\{}, but under more specific circumstances.

B.
.



Relevant Pages

  • RE: String Manipulation
    ... escaped asterisk. ... The slash is still special because it's the regexp ... The square brackets are a character class. ...
    (perl.beginners)
  • Re: finding specific sequence of wildcard characters
    ... to find single instances of the "*" character (i.e., the asterisk ... please post all follow-ups to the newsgroup so ...
    (microsoft.public.word.docmanagement)
  • Re: Message ID with mySQL?
    ... > conventions change. ... Hence the asterisk (or some other character that will do the job). ...
    (alt.html)
  • Re: Not like query
    ... To exclude anything beginning with 3 asterisks: ... However, asterisk is not a special character in the first case, so it ... >Can anyone suggest the correct syntax for this criteria. ...
    (microsoft.public.access.queries)
  • Re: Bash: Asterisk reading problem
    ... > character from a set of data files. ... > the asterisk symbol, which is causing problems with the exporting process. ...
    (uk.comp.os.linux)