1

I have a number of files that contain the following text:

{"job_id":"ds_sdfsd38474","status":"X people in the queue before you..."}

where X changes from file to file from numbers between 1-100.

I'm wondering, how i extract from the files only:

ds_sdfsd38474
2
awk -F\" '{print $4}' yourfile
1

You can use awk:

awk -F "\"" '{print $4}' yourfile
  • F for setting the separator
  • $4 is the fourth column

Or you can use cut:

cut -d\" -f 4 yourfile
  • d for setting the separator
  • f 4 is the fourth column

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.