The file is like this
aaa&123 bbb&234 ccc&345 aaa&456 aaa$567 bbb&678
I want to output:(contain "aaa" and text after &)
I want to do in in shell script, Follow code be consider
#!/bin/bash raw=$(grep 'aaa' 1.txt) var=$(cut -f2 -d"&" "$raw") echo $var
It give me a error like
cut: aaa&123 aaa&456 aaa$567: No such file or directory
How to fix it? and how to cut (or grep or other) from exist variables?