Looking through the man pages for sed, awk and grep, I'm unable to find a way to search for a string that is exactly n characters long.
Given the following text file, I want to extract just 6982a9948422
ID IMAGE COMMAND
CREATED STATUS PORTS
6982a9948422 ubuntu:12.04 apt-get install ping
1 minute ago Exit 0
The value will always be in the first column and is always 12 alphanumeric characters.
Here is what I am trying so far.
cat /tmp/test | awk {'print $1'} | sed 's/.*\([0-9],[A-Z],[a-z]\{12\}\).*//g'
What would be a way to extract just 6982a9948422 from the text above ?
docker ps -qand avoid having to do text manipulation at all.