1

Can I find and save in array (or string) all words in file that starts from specific offset in each line?

For example, I have file with the following text:

  270  mc
  271  sudo add-apt-repository ppa:webupd8team/unstable
  272  sudo apt-get update && sudo apt-get install go-mtpfs
  273  sudo apt-get install go-mtpfs-unity
  274  go-mtpf

I want to get the following list from it:

mc sudo sudo sudo go-mtfp
4

2 回答 2

1

为了获得第二场:

cut -d " " -f2 file

或以固定偏移量获取值(从位置 5 开始)

cut -c5- file
于 2013-11-12T21:23:24.210 回答
1

试试这一行:

awk '$0=$2' file
于 2013-11-12T21:23:59.227 回答