awk

awk

echo "hello::there::friend" | awk -F "::" '{print $1, $3}’

Output hello friend

cut can only accept a single character as a field delimiter, while awk, as shown, is much more flexible

  • Extract specific length woth from rockyou like 6 digit awk 'length($0) == 6' rockyou.txt

Last updated