reticentfat
V2EX  ›  问与答

linux 下如何截取字符串

  •  
  •   reticentfat · Aug 25, 2015 · 3326 views
    This topic created in 4090 days ago, the information mentioned may be changed or developed.
    txt 文件里边有 A,B,C 三个字段如下
    19 Y35U688 您好,提醒您: 15 年 08 月 12 日,小型汽车粤 Y53U66 在
    怎么能把车牌号即粤 Y35U68 提取出来
    2 replies  •  2015-08-26 13:29:41 +08:00
    reticentfat
    reticentfat
    OP
    Aug 25, 2015
    1
    写出来了
    bzcat a.txt.bz2 | iconv -f utf-8 -t gbk | awk -F'\t' '{print $3}' | awk -F',' '{print $3}'| awk '{print substr ($0,index ($0,"粤"),index ($0,"在")-5 )}'
    21grams
    21grams
    Aug 26, 2015
    2
    一句话三个号码居然个个不同,也是服了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3517 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:15 · PVG 13:15 · LAX 21:15 · JFK 00:15
    ♥ Do have faith in what you're doing.