Score:0

I can't change the value between two quotation marks with sed

gf flag

How can I replace the word at the very end of the first line using sed?

test00 ; test01 ; 'test02 -test03="j32h"'
test04

The result should look like below;

test00 ; test01 ; 'test02 -test03="b254"'
test04
Score:1
hr flag

Given

$ cat file
test00 ; test01 ; 'test02 -test03="j32h"'
test04

then

$ sed 's/"[^"]*"/"b254"/' file
test00 ; test01 ; 'test02 -test03="b254"'
test04
Score:1
cn flag

With we can use the double quote as a field separator, and replace he value of the 2nd field:

awk '
    BEGIN {FS = OFS = "\""} 
    NR == 1 {$2 = "b254"} 
    {print}
' <<END
test00 ; test01 ; 'test02 -test03="j32h"'
test04
END
test00 ; test01 ; 'test02 -test03="b254"'
test04
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.