I've a string separated with commas where i want to find my input in that line
echo US | grep "US,CA,CH,JP"
The output is empty! How should i use grep to find my input in that string?
I've a string separated with commas where i want to find my input in that line
The output is empty! How should i use grep to find my input in that string? |
|||
|
Swap the arguments of the commands:
In:
you are looking for the string (pattern) |
|||
|
Unless you were expecting the commas to act like an "or" statement, in which case you just need to change the commas to pipes and use the
Or change the commas to newline characters:
|
||||
|
I would use Instead of eco give it a list or something, where it can actually can go and look for patterns, instead of looking for them in "US" |
|||||
|