嘗試在Windows Powershell下使用這些文本處理命令
首先推薦在Windows的Microsoft store下載一個(gè)Windows terminal

windows terminal
會(huì)比powershell好看點(diǎn),還可以自定義背景字體等(bushi)
一、查看文件
替代命令:Windows下可替代Linux shell語言的命令
#less替代命令
more filename
#cat替代命令
type filename
二、文本處理
- awk
下載:Windows-awk
解壓后,bin文件夾下就有相對(duì)的awk.exe、gawk.exe文件 - sed
下載:Windows-sed - grep
下載:Windows-grep
接下來就是需要編輯配置文件,設(shè)置別名以便之后打開powershell終端都能用這幾個(gè)命令。
嘗試過在
#查看一下profile文件位置
echo $profile

$profile
#編輯profile
notepad $profile
#在打開的profile中寫入下面幾行命令
###把path改為你的安裝路徑嗷
Set-Alias grep path\grep\GnuWin32\bin\grep.exe
Set-Alias awk path\gawk-3.1.6-1-bin\bin\gawk.exe
Set-Alias sed path\sed\GnuWin32\bin\sed.exe
#保存并關(guān)閉
重啟powershell,就可以正常使用這些命令啦
參考文章:
科學(xué)網(wǎng)—windows下面使用awk、sed、grep、gnuplot - 陳超的博文 (sciencenet.cn)
關(guān)于配置文件 - PowerShell | Microsoft Learn
使用powershell profile文件添加永久別名AIias - 簡書 (jianshu.com)
三、常用命令學(xué)習(xí)
1.去重
sort -Unique