bash不輸出 包含A開頭,不包含B結尾的內 - Linux

By Rae
at 2019-10-30T18:17
at 2019-10-30T18:17
Table of Contents
小弟遇到比較繞口的問題,
要把一份文件不輸出:
包含以A開頭,不包含以B結尾的內容,
而其他內容都輸出
偏偏A=#
#後面有兩個空格
B=*
兩者都是特殊符號,卡了很久
小弟我想到以下:
grep -v '^# ' [^\*]$ 文件名
[^\*]$ 無法正常表示為 以*為結尾 的條件,想請教大大正解,感謝!
----
Sent from BePTT on my Google Pixel 3
--
要把一份文件不輸出:
包含以A開頭,不包含以B結尾的內容,
而其他內容都輸出
偏偏A=#
#後面有兩個空格
B=*
兩者都是特殊符號,卡了很久
小弟我想到以下:
grep -v '^# ' [^\*]$ 文件名
[^\*]$ 無法正常表示為 以*為結尾 的條件,想請教大大正解,感謝!
----
Sent from BePTT on my Google Pixel 3
--
Tags:
Linux
All Comments

By Ula
at 2019-10-31T07:47
at 2019-10-31T07:47

By Joseph
at 2019-11-01T03:11
at 2019-11-01T03:11

By Andy
at 2019-11-05T11:25
at 2019-11-05T11:25

By Catherine
at 2019-11-10T02:58
at 2019-11-10T02:58

By Edwina
at 2019-11-12T06:05
at 2019-11-12T06:05

By Lucy
at 2019-11-14T14:29
at 2019-11-14T14:29

By Harry
at 2019-11-17T13:07
at 2019-11-17T13:07

By Eden
at 2019-11-17T18:45
at 2019-11-17T18:45
Related Posts
linux有rgb控制軟體嗎?

By Gary
at 2019-10-28T18:51
at 2019-10-28T18:51
ubuntu 18.04如何重新安裝grub?

By Hedwig
at 2019-10-26T13:12
at 2019-10-26T13:12
使用者子群組與檔案權限問題

By Enid
at 2019-10-25T19:11
at 2019-10-25T19:11
find 找不到檔案~Orz

By Lucy
at 2019-10-24T14:36
at 2019-10-24T14:36
Strongswan to CloudVPN 設定問題

By Iris
at 2019-10-22T21:40
at 2019-10-22T21:40