echo \"A:\\ B:\\ C:\\ D:\\\" | awk -F\'[:\\]\' \'{print $1}\'
Output:
awk: warning: escape sequence `\\]\' treated as plain `]\'
A
This is also wrong:
echo "A:\ B:\ C:\ D:\"
You are escaping the "
and it breaks the input, you need to remove it or use single quote.
awk
does not like a single \
within field separator, so try:
echo 'A:\ B:\ C:\ D:\' | awk -F":|\\" '{print $1}'
A
Or you can escape it (single quote):
echo 'A:\ B:\ C:\ D:\' | awk -F'[:\\\\]' '{print $1}'
A
Or even more escaping (double quote):
echo 'A:\ B:\ C:\ D:\' | awk -F"[:\\\\\\\]" '{print $1}'
A