How Can I skip a variation of a number set?

linux-noob

New Member
Joined
Nov 3, 2018
Messages
2
Reaction score
1
Credits
0
Hello linux folks

I made a simple text file with these numbers:

1 0 0
1 2 3
5 7 9
3 2 1
0 0 7

I wrote a script to read each line of this file and if it finds a variation of that line to skip it.

for example, the variation of 1, 2 and 3 on line 2 is found on line 4. I want to skip line 4. Is this possible with bash? Thanks
 


Hello @linux-noob

I don't know about scripting but I thing you have to use regex in order to find the variations that you need.
 
Is this possible with bash?

Simple answer is "Yes", but it is beyond my paygrade (currently) to give specifics.

Code:
regex

... which friend Capta has pointed to can be involved. Most Linux commands have a builtin manual which you can access from Terminal by prefacing "man" to the basic command, eg

Code:
man regex

Many of these have online equivalents, and many can be downloaded as PDF for easier viewing.

Also in your scripting travels, you will encounter eg

Code:
grep

# and

egrep

and wonder what the difference is. An extract from

Code:
man grep

... reads, in part

In addition, the variant programs egrep, fgrep and rgrep are the same
as grep -E, grep -F, and grep -r, respectively. These variants are
deprecated, but are provided for backward compatibility.

We have some scripting Gurus here, and at risk of being killed (for their being busy on a weekend), I will invoke them with a Wizardly incantation ...

@JasKinasis and @Rob ... Scoobi-Doo where are you?

I'll watch and learn. Good luck and enjoy your Linux :D

and Avagudweegend

Chris Turner
wizardfromoz

Edited added BTW

BTW - we also have some new members including @HostechSupport whose skills I am still learning about :)
 
Last edited:

Members online


Top