Grep help
-
-
@laksh1999 said in Grep help:
This does not work for me.
I would love to see proof because I just showed you proof it does work.
-
@jaredbusch said in Grep help:
@laksh1999 said in Grep help:
This does not work for me.
I would love to see proof because I just showed you proof it does work.
cat newdata.txt | grep [V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]] zsh: no matches found: [V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]
-
@jaredbusch said in Grep help:
@laksh1999 said in Grep help:
json file
Then use
json
tools FFS.
man jq
cat wtf.txt | jq *.id
cat newdata.txt | jq *.id zsh: no matches found: *.id
-
@laksh1999 said in Grep help:
@jaredbusch said in Grep help:
@laksh1999 said in Grep help:
json file
Then use
json
tools FFS.
man jq
cat wtf.txt | jq *.id
cat newdata.txt | jq *.id zsh: no matches found: *.id
You didn't bother to read the
man
file.. i pulled that out of my ass from memory...the correct syntax is
jq '.id
but as this point I doubt you have the data you think you have in your text file.
-
@jaredbusch said in Grep help:
the correct syntax is
jq '.id'
I'm also assuming that
id
is one of thejson
keys based on your first post. -
@laksh1999 said in Grep help:
@jaredbusch said in Grep help:
@laksh1999 said in Grep help:
This does not work for me.
I would love to see proof because I just showed you proof it does work.
cat newdata.txt | grep [V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]] zsh: no matches found: [V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]
no one knows WTF you have in newdata.txt....
cat > test.txt << EOF stuff 1 A00000000 more stuff 1 stuff 2 B00000001 more stuff 2 stuff 3 C00000002 more stuff 3 stuff 4 D00000003 more stuff 4 stuff 5 E00000002 more stuff 5 EOF
then
cat test.txt | grep [AD][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]
-
@jaredbusch said in Grep help:
@jaredbusch said in Grep help:
the correct syntax is
jq '.id
I'm also assuming that
id
is one of thejson
keys based on your first post.There are more id values are there in the txt file
Example)
This id value example is only for the 1 tickets
"id"="D00000000"
"id" ="V00000000"
"id"="eeeeeee-eeeeee-eeeee-eeeee"
"id"="eadsga-ereagag"i just want to grep only D0000000 and V000000 values for each tickets.There are around 5000 tickets are there and each for more id for one ticket
-
@jaredbusch said in Grep help:
@laksh1999 said in Grep help:
@jaredbusch said in Grep help:
@laksh1999 said in Grep help:
This does not work for me.
I would love to see proof because I just showed you proof it does work.
cat newdata.txt | grep [V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]] zsh: no matches found: [V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]
no one knows WTF you have in newdata.txt....
cat > test.txt << EOF stuff 1 A00000000 more stuff 1 stuff 2 B00000001 more stuff 2 stuff 3 C00000002 more stuff 3 stuff 4 D00000003 more stuff 4 stuff 5 E00000002 more stuff 5 EOF
then
cat test.txt | grep [AD][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]
This worked for me now
cat test.txt | grep '[V][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]'
-
@laksh1999 said in Grep help:
want to grep
no you don't.
FFS how many times do I have to tell you.
Your data is
json
, use fuckingjson
tools.jq
is extremely powerful. Use it to correctly query yourjson
data to get the result you need. -