Urgent : Extract Pattern

Hi All,

I need ot extrat initial from a file name coming.

For example i have a file TOOL_Test_File1_AK.txt
i need to extract string AK from it that will come prior to .txt

other examples
TOOL_Test_File1_AKA.txt------ output should be AKA
TOOL_Test_File1_KASD.txt------ output KASD
TOOL_Test_File1_Aase.txt------ Aase

Please help

Hello!

In case you forgot to read the forum rules, here is quick copy.

Cheers.

The UNIX and Linux Forums

2 Likes