Skip to main content
added 217 characters in body
Source Link
slm
  • 379.8k
  • 127
  • 793
  • 897

You can use grep with the PCRE facility. It's available in most of the newer versions of grep.

$ grep -oP "^(\w"^[[:alnum:]]{12})" test.txt 
6982a9948422

This will give you all the matches that are 12 long and include characters that are valid in words, [a-zA-Z0-9].

You can use grep with the PCRE facility. It's available in most of the newer versions of grep.

$ grep -oP "^(\w{12})" test.txt 
6982a9948422

You can use grep with the PCRE facility. It's available in most of the newer versions of grep.

$ grep -oP "^[[:alnum:]]{12}" test.txt
6982a9948422

This will give you all the matches that are 12 long and include characters that are valid in words, [a-zA-Z0-9].

Source Link
slm
  • 379.8k
  • 127
  • 793
  • 897

You can use grep with the PCRE facility. It's available in most of the newer versions of grep.

$ grep -oP "^(\w{12})" test.txt 
6982a9948422