Combo for text


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Combo for text
# 1  
Old 07-26-2016
Combo for text

Hello all,
i need to extract a part from an API output. Imagine this is the output :

Code:
"result":[]
"result":["alternative":["transcript":"hello my name is Mike"
"confidence":0.98091763
"transcript":"Hello My Name Is Mud"

i need to use only the "hello my name is Mike" in the second line, without " "

how can i do that?
Thanks in advance

Kind Regards and congrats for the great forum.
# 2  
Old 07-26-2016
Hello Board27,

If your Input_file's 2nd line is the one which you want to always get then following may help you in same.
Code:
awk 'NR==2{gsub(/.*:\"/,X,$0);sub(/\"/,X,$0);print}'   Input_file
OR
awk -F"\"" 'NR==2{;print $(NF-1)}'   Input_file
OR
awk 'NR==2{match($0,/:\".*\"$/);print substr($0,RSTART+2,RLENGTH-3)}'   Input_file

Output will be as follows.
Code:
hello my name is Mike

Thanks,
R. Singh

Last edited by RavinderSingh13; 07-26-2016 at 08:54 AM.. Reason: Added one more solution now for same.
This User Gave Thanks to RavinderSingh13 For This Post:
# 3  
Old 07-26-2016
thanks a lot!
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing CRLF combo but not CR or LF when alone

What is the command or script to remove CRLF but only when joined? Tried using below but removed all instances of either cat a.txt | tr -d "\r\n" > b.txt (14 Replies)
Discussion started by: qqp
14 Replies

2. Shell Programming and Scripting

grep, awk, nawk combo

I have 2 files: File1 "aa","server","001-9031234-001", File2 001-9031234-001|12345 Both files have many lines of text. Each line needs to be evaluated. I need to look at the value of the third field in File 1. Then look for that same value in File 2 and assign the value of Field 2... (5 Replies)
Discussion started by: scriptr2be
5 Replies

3. UNIX for Advanced & Expert Users

What one line unix talk combo generates the following....

What one line unix talk combo would generate 95% cpu load? Im talking like something below (1 Reply)
Discussion started by: frequency8
1 Replies

4. UNIX for Dummies Questions & Answers

Modem/Sound combo

I just got yet another PI! yay! :D . one problem... the sound/modem card is not detected by the kernel or even by windows PnP! i dunno of any UNIX driverDB online, but if you could point me to one, it would be fantastic! (4 Replies)
Discussion started by: boris888
4 Replies
Login or Register to Ask a Question