gpt4 book ai didi

linux - 如何使用 GREP 列出文件中不含数字的所有行?

转载 作者:太空宇宙 更新时间:2023-11-04 04:44:49 24 4
gpt4 key购买 nike

我有一个名为 sdata.txt 的文件,其中包含以下信息:

UID        PID  PPID  C STIME TTY          TIME CMD
root 1 0 0 Oct16 ? 00:01:15 /sbin/init
root root
root 10 2 0 Oct16 ? 00:00:02 [migration/0]
root20
t90hch1 478 442 0 13:24 ? 00:00:00 sshd: t90hch1@pts/3
support

T90hch1 488 478 0 13:24 pts/3 00:00:00 -bash
root20 498 1 0 Oct16 ? 00:00:00 /sbin/mdadm --monitor --scan
root 730 1498 0 13:27 ? 00:00:00 sshd: z1746903 [priv]
z1J46903 763 48 0 13:27 ? 00:00:00 rooot: z1746903@pts/18
z4746903 764 763 0 13:27 pts/18 00:00:00 -bash
root 1492 1 0 Oct16 ? 00:00:32 /usr/sbin/testooooo
daemon 1493 408 1 0 Oct16 ? 00:00:00 /usr/sbin/atd -f
zY6A7846 1716 24089 0 13:35 pts/41 00:00:00 nano +183 Assign5.cpp
z1746903 1751 764 0 13:35 pts/18 00:00:00 nano
z1234567 1799 888 bAsh
r78959j1 499 BUSH

我必须使用 grep 才能列出该文件中不含数字的行。我还有另一个问题,其中我必须列出所有具有以 4 开头并以 8 结尾的 2 位或 3 位数字的行。如果是 3 位数字,则中间数字必须为 6 或更大。我真的很难受这个问题。

最佳答案

grep -v '[0-9]' sdata.txt

...只是一个正则表达式:-)

关于linux - 如何使用 GREP 列出文件中不含数字的所有行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43358882/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com