Hi,
1) is there a Unix/Linux program that can generate words (not random characters) out of a set of characters (say: "5.tpiuongf"). If this
doesn't exist:
2) Is it possible to write a script that does the above out of, for
example, /usr/share/dict/* ?
So, I want to find all lines that contain _only_ one or more of any of "5.tpiuongf".
Naively, I started experimenting with [e]grep but I suspect it's not the right way.
On 23.09.21 09:23, Ottavio Caruso wrote:
Hi,
1) is there a Unix/Linux program that can generate words (not random
characters) out of a set of characters (say: "5.tpiuongf"). If this
doesn't exist:
2) Is it possible to write a script that does the above out of, for
example, /usr/share/dict/* ?
So, I want to find all lines that contain _only_ one or more of any of
"5.tpiuongf".
Naively, I started experimenting with [e]grep but I suspect it's not the
right way.
Well, in the past I had used to use awk for that, as in
awk '!/[^5.tpiuongf]/'
(i.e. working with double negation).
Janis
Hi,
1) is there a Unix/Linux program that can generate words (not random characters) out of a set of characters (say: "5.tpiuongf"). If this
doesn't exist:
2) Is it possible to write a script that does the above out of, for
example, /usr/share/dict/* ?
So, I want to find all lines that contain _only_ one or more of any of "5.tpiuongf".
Naively, I started experimenting with [e]grep but I suspect it's not the right way.
Using grep with the same logic is of course also possible
grep -v '[^5.tpiuongf]'
On 23/09/2021 13:33, Andy Walker wrote:
On 23/09/2021 10:15, Janis Papanagnou wrote:
Using grep with the same logic is of course also possible
grep -v '[^5.tpiuongf]'
FWIW,
grep '^[5.tpiuongf]*$'
works here, and is one character shorter.
Fantastic, that's exactly what I was looking for.
One question: do I not have to escape the dot [.]?
On 23/09/2021 10:15, Janis Papanagnou wrote:
Using grep with the same logic is of course also possible
grep -v '[^5.tpiuongf]'
FWIW,
grep '^[5.tpiuongf]*$'
works here, and is one character shorter.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 293 |
Nodes: | 16 (2 / 14) |
Uptime: | 227:09:09 |
Calls: | 6,624 |
Calls today: | 6 |
Files: | 12,171 |
Messages: | 5,318,848 |