Unix/Linux Go Back    

How to Post in the The UNIX and Linux Forums Tutorials for how to post and interact in the forums.

Urgent : Extract Pattern

How to Post in the The UNIX and Linux Forums

extract block of text

Thread Tools Search this Thread Display Modes
Old Unix and Linux 11-26-2013
Arun Shukla Arun Shukla is offline
Registered User
Join Date: Jul 2013
Last Activity: 30 November 2013, 1:33 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
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
Sponsored Links
Old Unix and Linux 11-26-2013
Neo's Unix or Linux Image
Neo Neo is offline Forum Staff  
Join Date: Sep 2000
Last Activity: 20 September 2017, 12:41 PM EDT
Location: Asia pacific region
Posts: 13,632
Thanks: 863
Thanked 1,168 Times in 547 Posts

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


(1) No flames, shouting (all caps), sarcasm, bullying, profanity or arrogant posts.

(2) No negative comments about others or impolite remarks. Be patient.

(3) Refrain from idle chatter that does not contribute to the knowledge base. This does not apply to the forums in The Unix Lounge which are for off-topic discussions.

(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.

(5) Search the forums database with your keywords before asking.

(6) Do not post classroom or homework problems.

(7) No job postings from headhunters or recruiters except in The Unix Forums Job Board. See How to Post to The UNIX Forums Job Board for information on using the Job Board.

(8) No BSD vs. Linux vs. Windows or similar threads.

(9) Edit your posts if you see spelling or grammar errors (don't write in cyberchat or cyberpunk style). English only.

(10) Don't post your email address and ask for an email reply. Don't send a private message with a technical question. The forums are for the benefit of all, so all Q&A should take place in the forums.

(11) Post questions with descriptive subjects. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".

(12) These are not hacker boards so hacker related posts will be promptly deleted or moderated.

(13) The forum administrators reserve the right to prune, move or edit posts that do not adhere to the rules or are technically inaccurate.

(14) The forum administrators reserve the right to remove users or change their posting status to read only without notice if any rules are not followed.

(15) No smoking in the forums.

The UNIX and Linux Forums
The Following 2 Users Say Thank You to Neo For This Useful Post:
chenyung (01-19-2015), rbatte1 (11-28-2013)
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s) AshwaniSharma09 Shell Programming and Scripting 7 07-24-2012 11:55 AM
Urgent help pls.how to extract two lines having same starting number umapearl Emergency UNIX and Linux Support 18 07-03-2010 10:37 PM
Extract block of data and the error reason too. So so urgent Gopal_Engg Shell Programming and Scripting 2 07-23-2009 08:55 AM
sed: Find start of pattern and extract text to end of line, including the pattern TestTomas Shell Programming and Scripting 5 05-27-2009 11:16 AM
extract some specific text file urgent pls reyazan UNIX for Dummies Questions & Answers 2 10-20-2005 09:36 AM

All times are GMT -4. The time now is 02:16 PM.