Please use ***
[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do
not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.
Please show us the contents of the "$line" variable, the
exact commands you're using, and the output/error messages you're getting. We can't see your screen, so we have no idea what you're doing wrong.
Some more context on what you are trying to do would help too. Where is this input coming from, and what do you really need to do with it?
In short, give us more details. It may be that there are better ways to do what you want.
Those long chains of separate
seds are rather ugly in any case. You should be able to easily condense them into fewer ones. In fact, we could probably just do something like this:
Code:
read var1 var2 var3 _ <<<"$( sed -r '/(^$|[,-]|SQL|NAME)/d' <<<"$line" )"
Note that the above assumes there's always only a
single line of text left after all the (d)eletes, and that that line will have at least 3 fields (anything extra will go into the throw-away _ variable.
It's also possible that
awk is a better choice, since it's field-based. Or one of the shell's built in
string manipulations. But again, we need to see what the input looks like before saying for sure.