Specific string parsing in Linux/UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Specific string parsing in Linux/UNIX
# 1  
Old 05-13-2014
Specific string parsing in Linux/UNIX

Hi,
I have a string which can be completely unstructred. I am looking to parse out values within that String.
Here is an example

<Random Strings> String1=<some number a> String2=<some number b> String3=<some number c> Satish=<some number d> String4=<some number e>


I only want to parse out the number with is assigned to key Satish which in this case will be <some number d>
I have tried to do with awk, where I hard code the place where Satish appears... but in cases where Satish appears out of place, I run into issues. Can someone please help me out?

Thanks,
Satish
# 2  
Old 05-13-2014
Code:
[user@host ~]$ echo "String1=01234 String2=56546 String3=24356 Satish=1234 String4=2345" | sed 's/.*Satish=\([0-9]*\).*/\1/'
1234
[user@host ~]$

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String parsing help across multiple UNIX platforms

Need to parse XML like strings from a file. Using `egrep -A 1 "Panel Temp" "$2" | tail -2` I get the following string: <parameter name="Panel Temp" unit="0.1 C"> <value size="1" starttime="06-08-2017 09:36:56.968">95</value> I want to output: {"Panel Temp" 9.5 C} The 9.5 C is the value... (16 Replies)
Discussion started by: harleyvrodred
16 Replies

2. UNIX for Beginners Questions & Answers

Get string before specific word in UNIX

Hi All, I'm writing unix shell script and I have these files. I need to get name before _DETL.tmp. ABC_AAA_DETL.tmp ABC_BBB_DETL.tmp ABC_CCC_DETL.tmp PQR_DETL.tmp DEF_DETL.tmp JKL_DETL.tmp YUI_DETL.tmp TG_NM_DDD_DETL.tmp TG_NM_EEE_DETL.tmp GHJ_DETL.tmp RTY_DETL.tmp output will... (3 Replies)
Discussion started by: ace_friends22
3 Replies

3. UNIX for Dummies Questions & Answers

Delete Unix/Linux file at a specific time in future.

Hi, I was wondering if there is a command to delete a file in the future. For example: If I create a file named unix.lst using the vi editor, but after I create it, what command will be suitable to delete "unix" files from the system at 13:40 military time with no log file. I was going to... (3 Replies)
Discussion started by: abhi7514
3 Replies

4. Shell Programming and Scripting

string parsing using UNIX

I got multple sql files.such as >>vi abc.sql select A.SITENAME, NULL NULL A.CREATE_DTM NULL A.MODIFY_DTM NULL FROM ${STG_RET_ITEM} A INNER JOIN ${STG_INC_COMP} B ON (A.CUSTID=B.CUSTID) LEFT OUTER JOIN ( select C.SITEID,SITESTATUS,MIN_EFF_DT,CURR_ST_DT,MAX_IN_DT,MAX_ACT_DT from... (4 Replies)
Discussion started by: ali123
4 Replies

5. Shell Programming and Scripting

Parsing a long string string problem for procmail

Hi everyone, I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email. Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string. GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies

6. Shell Programming and Scripting

Html parsing - get line after specific string till a point

Hi all :) It sounds complex, for example I want to find the whole html file (there are 5 entries of this string and I need to get all of them) for the string "<td class="contentheading" width="100%">", get the next line from it only till the point that says "</td>", plus removing \t (tabs) ... (6 Replies)
Discussion started by: hakermania
6 Replies

7. Shell Programming and Scripting

parsing filename and grabbing specific string patterns

Hi guys...Wow I just composed a huge post and it got erased as I was logged out automatically Anyways I hope someone can help me out here. So the task I'm working on is like this I have a bunch of files that I care about sitting in a directory say $HOME/files Now my job is to go and loop... (6 Replies)
Discussion started by: rukasetsuna
6 Replies

8. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

9. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

10. Shell Programming and Scripting

Parsing string using specific delimiter

Hi, I'm wondering what is the best way to parse out a long string that has a specific deliminator and outputting each token between the delim on a newline? i.e. input text1,text2,text3,tex4 i.e. output text1 text2 text3 text4 (8 Replies)
Discussion started by: primp
8 Replies
Login or Register to Ask a Question