实用 shell
本文最后更新于 943 天前,其中的信息可能已经有所发展或是发生改变。

文本处理

清除每行头&尾部的空白符

awk '{$1=$1;print}'

ref: https://stackoverflow.com/questions/448005/whats-an-easy-way-to-read-random-line-from-a-file

在一个文本随机选取若干行

// macos 则先 brew install coreutils,然后用 gshuf
shuf foo.txt | head -n 100
cat foo.txt | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort -k1 -n | cut -f2- | head -n 100

ref: https://stackoverflow.com/questions/448005/whats-an-easy-way-to-read-random-line-from-a-file

截取每行的前几个字符

cut -c 1-3 file // 前三个字符

ref: https://stackoverflow.com/questions/19869511/how-to-restrict-length-of-string-present-in-a-line-using-linux

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇