I'm not sure how to express this using the csh
string matching syntax. I want to test whether a csh variable contains a newline. I'm basically looking for:
if ($mystr !~ <pattern for strings which contain a newline character>)
Edit: in my particular case, I am trying to make a string like this pass:
1234ABC
And a string like this fail:
1234ABC
-------
FOOBAR
These are the output of a sed
command, namely sed '1d;$d'
. Not sure if that matters.
The reason why I am trying to detect newlines rather than " -------"
is for defense against changes in the formatting of the file I'm parsing. (Anyway, I don't think it matters what I'm doing with the file exactly, since I'm just looking for a general solution for detecting a newline character.)
csh
? Do you want to check if the string is contained in$mystr
or if the two are identical? – terdon May 07 '14 at 18:05csh
, and I just want to check to see if there is a newline character in$mystr
. – 2rs2ts May 07 '14 at 18:12$mystr
is/contains a specific multiline string or do you just need to check whether$mystr
contains newline character(s)? The two are completely different. Please [edit] your question and clarify. – terdon May 07 '14 at 18:14\n
but have nocsh
knowledge so I don't know what the match syntax would be or even ifcsh
can match. – terdon May 07 '14 at 18:26$mystr
against a specific multiline variable. I edited to clarify that's not what you're after. Feel free to revert. – terdon May 07 '14 at 18:26