On Sat, Apr 16, 2022 at 09:27:52PM -0500, Kent West wrote:
> -- data.txt --
> black berry 12
> blue berry 14
> raspberry 9
> huckle berry hound 3
> bare-knuckle sandwich 27
>
> -- test.sh --
> #!/bin/bash
>
> file="data.txt"
>
> while read -r line; do
>productID=$(awk -F' ' '{$NF=""; print $
On Sat, Apr 16, 2022 at 11:01 AM Nicholas Geovanis
wrote:
> On Fri, Apr 15, 2022, 9:37 PM wilson wrote:
>
>> Hello
>>
>> in shell script, how can I use regex to extract values from a string?
>> maybe value types transformation should be required.
>>
>>
>> for instance the string: "black berry 12
On 17/04/2022 12:38, Greg Wooledge wrote:
On Sun, Apr 17, 2022 at 12:31:34PM +1200, Ash Joubert wrote:
Python is a convenient and scriptable solution for many text processing
problems. You can call it from within bash:
But you really *shouldn't*. What's the point of writing your script
in two
On Sun, Apr 17, 2022 at 12:31:34PM +1200, Ash Joubert wrote:
> Python is a convenient and scriptable solution for many text processing
> problems. You can call it from within bash:
But you really *shouldn't*. What's the point of writing your script
in two different languages, and having to run tw
On 17/04/2022 12:31, Ash Joubert wrote:
Note the change to your regex: '\' changed to '\\' because bash variable
interpolation is used to obtain $X . This could be avoided if single
quotes were used, but then you would need another way to access your
data, such as reading it from stdin.
Actua
On 16/04/2022 14:37, wilson wrote:
in shell script, how can I use regex to extract values from a string?
maybe value types transformation should be required.
for instance the string: "black berry 12".
I want go get the name: black berry [String]
the price: 12 [Int]
I did this in other language s
On 4/16/22 09:47, Nicholas Geovanis wrote:
On 4/15/22 19:37, wilson wrote:
Hello
in shell script, how can I use regex to extract values from a
string? maybe value types transformation should be required.
for instance the string: "black berry 12". I want go get the name:
black berry [Strin
On Sat, Apr 16, 2022 at 06:12:17PM +0200, to...@tuxteam.de wrote:
> FWIW, bash has an =~ operator for regex matching whithin [[ ]]. There are
> even special variables to pick up the capturing matches.
>
> Not portable, but arrays (which have been warmly recommended around here)
> aren't, either.
On Sat, Apr 16, 2022, 11:12 AM wrote:
> On Sat, Apr 16, 2022 at 11:01:17AM -0500, Nicholas Geovanis wrote:
> > On Fri, Apr 15, 2022, 9:37 PM wilson wrote:
> >
> > > Hello
> > >
> > > in shell script, how can I use regex to extract values from a string?
> > > maybe value types transformation shou
On Sat, Apr 16, 2022 at 11:01:17AM -0500, Nicholas Geovanis wrote:
> On Fri, Apr 15, 2022, 9:37 PM wilson wrote:
>
> > Hello
> >
> > in shell script, how can I use regex to extract values from a string?
> > maybe value types transformation should be required.
> >
> >
> > for instance the string:
On Fri, Apr 15, 2022, 9:37 PM wilson wrote:
> Hello
>
> in shell script, how can I use regex to extract values from a string?
> maybe value types transformation should be required.
>
>
> for instance the string: "black berry 12".
> I want go get the name: black berry [String]
> the price: 12 [Int
On Sat, Apr 16, 2022 at 10:37:14AM +0800, wilson wrote:
> in shell script, how can I use regex to extract values from a string?
"Some people, when confronted with a problem, think ``I know, I'll use
regular expressions.'' Now they have two problems."
> for instance the string: "black berry 12".
>
12 matches
Mail list logo