kalebroccoli
V2EX  ›  问与答

求一个 shell 如何写

  •  
  •   kalebroccoli · Jan 20, 2020 · 2033 views
    This topic created in 2337 days ago, the information mentioned may be changed or developed.

    新手求一个 shell 如何写,谢谢!

    文件中有有如下字段

    378ce56a-78c7-4571-afac-24365963d093 cirros-0.3.5

    15a3c5b1-6c2e-4357-b43d-dc52d605ba5d Floodlight_1.0_desktop_cv1.0

    d8d9e3a3-5323-4211-8f83-2f31e3bc1b7a k8s-master-node

    b7cff6cd-487e-4b63-b3d5-c7d191cb7439 L2_ovs2.6_2

    08117d70-ed29-4c73-a448-247be8b9994c Mininet2.2.0_ovs2.3.0_desktop_cv1.0

    bcd11c2e-268a-42a8-bafb-bfb136e95118 Mininet_2.2.0_desktop

    使用如下的命令导出 openstack 的镜像。

    glance image-download --file=/opt/cirros-0.3.5 378ce56a-78c7-4571-afac-24365963d093

    请问如何用 shell 脚本 一 一对应批量导出 谢谢

    2 replies    2020-01-20 17:33:50 +08:00
    mikeguan
        1
    mikeguan  
       Jan 20, 2020 via Android
    awk '{print "glance image-download --file=/opt/"$2 $1}'
    mikeguan
        2
    mikeguan  
       Jan 20, 2020 via Android
    忘记加空格了
    awk '{print "glance image-download --file=/opt/"$2 " " $1}'
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   870 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:40 · PVG 04:40 · LAX 13:40 · JFK 16:40
    ♥ Do have faith in what you're doing.