How can I print contents of file given filename as stdin in bash?

Christopher Shroba

Is there a bash command like cat except that it takes the filename from stdin rather than the first argument? For example:

echo "/home/root/file.txt" | somecommand

would have the same output as cat /home/root/file.txt

Christopher Shroba

Found the answer:

xargs cat

For example:

echo "/home/root/file.txt" | xargs cat

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How can I find the string value of a property given it's value

来自分类Dev

How to print entire line in BASH

来自分类Dev

How can I used ReadAllLines with gzipped file

来自分类Dev

如何检查$ data = file_get_contents(“ php:// stdin”)是否为空?

来自分类Dev

PHP - echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/server/main/' . $filename) 无法访问

来自分类Dev

How to read filename of the last modified file in a directory?

来自分类Dev

How can I display unique words contained in a Bash string?

来自分类Dev

How can I *only* get the number of bytes available on a disk in bash?

来自分类Dev

Given the function `decode`, how can I do the inverse and write a function to `encode`?

来自分类Dev

Bash脚本,stdin

来自分类Dev

Bash脚本和stdin

来自分类Dev

How to merge contents of SQLite 3.7 WAL file into main database file

来自分类Dev

Using Gradle, how can I ensure that a file exists at a certain location?

来自分类Dev

How to parse a text file (CSV) into haskell so I can operate on it?

来自分类Dev

How can I recursively find the *directories* containing a file of a certain type?

来自分类Dev

How can I loop through values in my json file?

来自分类Dev

How can I work with a .csv file using Java Spring Resttample?

来自分类Dev

How can I find my browser web log file?

来自分类Dev

我的PHP foreach循环正确输出print_r,但未正确输出file_put_contents

来自分类Dev

How do I print out just certain elements from a text file that has xml tags to a new text file?

来自分类Dev

从stdin或file输入,C

来自分类Dev

Understanding the process of loading multiple file contents into Dask Array and how it scales

来自分类Dev

删除(STDIN)= BASH中的标签

来自分类Dev

BASH中的stdin / stdout名称?

来自分类Dev

How can I use sed to make thousands of substitutions in a file using a reference file?

来自分类Dev

How can i get from a FileInfo[] the file full name full directory including the file extension?

来自分类Dev

Given a table of data and number of occurrences, can I create the underlying dataset?

来自分类Dev

How do I assign contents of a string to a text field in Unity 4.6?

来自分类Dev

how do I print an integer in Swift

Related 相关文章

  1. 1

    How can I find the string value of a property given it's value

  2. 2

    How to print entire line in BASH

  3. 3

    How can I used ReadAllLines with gzipped file

  4. 4

    如何检查$ data = file_get_contents(“ php:// stdin”)是否为空?

  5. 5

    PHP - echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/server/main/' . $filename) 无法访问

  6. 6

    How to read filename of the last modified file in a directory?

  7. 7

    How can I display unique words contained in a Bash string?

  8. 8

    How can I *only* get the number of bytes available on a disk in bash?

  9. 9

    Given the function `decode`, how can I do the inverse and write a function to `encode`?

  10. 10

    Bash脚本,stdin

  11. 11

    Bash脚本和stdin

  12. 12

    How to merge contents of SQLite 3.7 WAL file into main database file

  13. 13

    Using Gradle, how can I ensure that a file exists at a certain location?

  14. 14

    How to parse a text file (CSV) into haskell so I can operate on it?

  15. 15

    How can I recursively find the *directories* containing a file of a certain type?

  16. 16

    How can I loop through values in my json file?

  17. 17

    How can I work with a .csv file using Java Spring Resttample?

  18. 18

    How can I find my browser web log file?

  19. 19

    我的PHP foreach循环正确输出print_r,但未正确输出file_put_contents

  20. 20

    How do I print out just certain elements from a text file that has xml tags to a new text file?

  21. 21

    从stdin或file输入,C

  22. 22

    Understanding the process of loading multiple file contents into Dask Array and how it scales

  23. 23

    删除(STDIN)= BASH中的标签

  24. 24

    BASH中的stdin / stdout名称?

  25. 25

    How can I use sed to make thousands of substitutions in a file using a reference file?

  26. 26

    How can i get from a FileInfo[] the file full name full directory including the file extension?

  27. 27

    Given a table of data and number of occurrences, can I create the underlying dataset?

  28. 28

    How do I assign contents of a string to a text field in Unity 4.6?

  29. 29

    how do I print an integer in Swift

热门标签

归档