LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-08-2015, 03:36 AM   #1
snehasishmohanta
LQ Newbie
 
Registered: Dec 2014
Posts: 2

Rep: Reputation: Disabled
getting the pattern of the value to print


what can be the pattern to get the value of "q"
below is my JSON file:-
Code:
{"requestDate":"2014-12-17 00:00:13.120","taskId":"558b7f40-014a-1000-803d-970e8333b0c9","appData":{"user_ip":"170.61.236.1, 10.0.255.47","_request_params":{"params":{"uid":["59a07452-8517-4713-c9b3-82bfd408c9f1"],"filtered":["false","false"],"requestId":["55897963-014a-1000-8021-970e8333b0c9"],"sort_by":["price "],"bId":["control"],"userid":["003f9510-2cc3-4925-efaa-3b0779082c77"],"sku":["4532886"],"q":["<U+200B><U+200B>
<U+200B>baby carrier"],"eId":["control"],"action":["click"],"sort_order":["asc"],"z":["1"]},"headers":{"x-bluecoat-via":"87ca26b138e17f23","accept-language":"en-US,en;q\u003d0.8","host":"api.apac-sg.zettata.com","x-forwarded-for":"170.61.236.1, 10.0.255.47","x-forwarded-port":"80","user-agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36","x-forwarded-proto":"http","cache-control":"max-stale\u003d0","x-real-ip":"10.0.255.47","referer":"http://www.shopclues.com/mum-mee-baby-sling-carrier-1.html","accept-encoding":"gzip, deflate, sdch"},"inCookies":[],"post":false},"cookies":[],"request_params":{"params":{"uid":["59a07452-8517-4713-c9b3-82bfd408c9f1"],"filtered":["false","false"],"requestId":["55897963-014a-1000-8021-970e8333b0c9"],"sort_by":["price "],"bId":["control"],"userid":["003f9510-2cc3-4925-efaa-3b0779082c77"],"sku":["4532886"],"q":["<U+200B><U+200B><U+200B>baby carrier"],"eId":["control"],"action":["click"],"sort_order":["asc"],"z":["1"]},"headers":{"x-bluecoat-via":"87ca26b138e17f23","accept-language":"en-US,en;q\u003d0.8","host":"api.apac-sg.zettata.com","x-forwarded-for":"170.61.236.1, 10.0.255.47","x-forwarded-port":"80","user-agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36","x-forwarded-proto":"http","cache-control":"max-stale\u003d0","x-real-ip":"10.0.255.47","referer":"http://www.shopclues.com/mum-mee-baby-sling-carrier-1.html","accept-encoding":"gzip, deflate, sdch"},"inCookies":[],"post":false},"user_agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"},"cookies":[],"status":200}
from this i want to get the value of q like this:-
Quote:
<U+200B><U+200B><U+200B>baby carrier
 
Old 01-08-2015, 08:36 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,277

Rep: Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443Reputation: 4443
Quote:
Originally Posted by snehasishmohanta View Post
what can be the pattern to get the value of "q"
below is my JSON file:-
Code:
{"requestDate":"2014-12-17 00:00:13.120","taskId":"558b7f40-014a-1000-803d-970e8333b0c9","appData":{"user_ip":"170.61.236.1, 10.0.255.47","_request_params":{"params":{"uid":["59a07452-8517-4713-c9b3-82bfd408c9f1"],"filtered":["false","false"],"requestId":["55897963-014a-1000-8021-970e8333b0c9"],"sort_by":["price "],"bId":["control"],"userid":["003f9510-2cc3-4925-efaa-3b0779082c77"],"sku":["4532886"],"q":["<U+200B><U+200B>
<U+200B>baby carrier"],"eId":["control"],"action":["click"],"sort_order":["asc"],"z":["1"]},"headers":{"x-bluecoat-via":"87ca26b138e17f23","accept-language":"en-US,en;q\u003d0.8","host":"api.apac-sg.zettata.com","x-forwarded-for":"170.61.236.1, 10.0.255.47","x-forwarded-port":"80","user-agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36","x-forwarded-proto":"http","cache-control":"max-stale\u003d0","x-real-ip":"10.0.255.47","referer":"http://www.shopclues.com/mum-mee-baby-sling-carrier-1.html","accept-encoding":"gzip, deflate, sdch"},"inCookies":[],"post":false},"cookies":[],"request_params":{"params":{"uid":["59a07452-8517-4713-c9b3-82bfd408c9f1"],"filtered":["false","false"],"requestId":["55897963-014a-1000-8021-970e8333b0c9"],"sort_by":["price "],"bId":["control"],"userid":["003f9510-2cc3-4925-efaa-3b0779082c77"],"sku":["4532886"],"q":["<U+200B><U+200B><U+200B>baby carrier"],"eId":["control"],"action":["click"],"sort_order":["asc"],"z":["1"]},"headers":{"x-bluecoat-via":"87ca26b138e17f23","accept-language":"en-US,en;q\u003d0.8","host":"api.apac-sg.zettata.com","x-forwarded-for":"170.61.236.1, 10.0.255.47","x-forwarded-port":"80","user-agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36","x-forwarded-proto":"http","cache-control":"max-stale\u003d0","x-real-ip":"10.0.255.47","referer":"http://www.shopclues.com/mum-mee-baby-sling-carrier-1.html","accept-encoding":"gzip, deflate, sdch"},"inCookies":[],"post":false},"user_agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"},"cookies":[],"status":200}
from this i want to get the value of q like this:-
Please see the "Question Guidelines" link in my posting signature. We will be happy to HELP you, but we aren't going to write things FOR YOU. Also, you have to provide details, like what programming language you're using, version/distro of Linux, what your goals actually are, etc.

Post what you have written/tried of your own, and where you're stuck, and we may be able to help. There are many, MANY ways to grab that pattern, depending on the language.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GAWK Find Pattern Print Lines Before and After metallica1973 Programming 3 11-07-2013 10:12 PM
[SOLVED] awk print pattern match line and subsequent dmesserly Programming 2 04-09-2013 06:27 PM
[SOLVED] print 2nd value of matching pattern progchi Linux - General 2 03-22-2013 07:55 AM
[SOLVED] sed/awk to print every before line that pattern match niharikaananth Linux - Newbie 10 02-22-2012 11:47 PM
awk print lines that doesn't have a pattern huynguye Programming 5 05-04-2006 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration