Bash foreach loop

前端 未结 7 1251
别跟我提以往
别跟我提以往 2020-12-22 20:39

I have an input (let\'s say a file). On each line there is a file name. How can I read this file and display the content for each one.

7条回答
  •  离开以前
    2020-12-22 21:28

    You'll probably want to handle spaces in your file names, abhorrent though they are :-)

    So I would opt initially for something like:

    pax> cat qq.in
    normalfile.txt
    file with spaces.doc
    
    pax> sed 's/ /\\ /g' qq.in | xargs -n 1 cat
    <>
    <>
    
    pax> _
    

提交回复
热议问题