Hi,
I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the section of text I'd like(S1234) probably is. The numbers in S1234 aren't always the same (could be S4521 or S332 or any other 3 or 4 digit combination).
I've tried various combinations of tr, awk, grep, and sed, but haven't been able to find exactly the command to do it. I'm going through a lot of files and basically just need to identify each file by that S123 label. Anyone got a quick one or two liner that would do what I need?
-- The S123 can have 3 or 4 digits and the leading S can be upper or lowercase (yay for non-standardized filenames)
-- This is running on SunOs 5.8 (only have access to the tools that came with that version of Solaris)
-- I am trying to add this in to a csh script.
Any help would be greatly appreciated!
Thanks,
Keane