zoukankan      html  css  js  c++  java
  • getline数据来源你的三种方式

    (1)getline从交互式的用户输入中c中获取内容;

    # awk 'BEGIN {system("echo "Input your name:"");getline d;print "
    Your name is",d"!
    "}'
    Input your name:
    berry
    
    Your name is berry!
    
    # awk 'BEGIN {system(" echo "Input your name:\c" ");getline d;print "
    Your name is",d"!
    "}'
    Input your name:berry
    
    Your name is berry!

    (2)getline从文件中获取内容;

    # awk -F":" 'BEGIN{while(getline < "/etc/passwd" >0){if($1~"sy"){print $1}}}'
    sys
    sync
    syslog

    (3)从命令输出中获取;

    # awk 'BEGIN{"date" | getline d; print d}'
    Sun Jan  1 22:37:50 CST 2017
  • 相关阅读:
    Remote API(RAPI)之 文件管理
    vue前端框架

    托马斯彩色回旋
    VUE?
    cookie与session
    ajax前后端分离
    djangoIII
    Django少年
    django三板斧
  • 原文地址:https://www.cnblogs.com/Berryxiong/p/6241707.html
Copyright © 2011-2022 走看看