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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I print a newline as \n in bash?

From Dev

How can I get the contents of a line up to the first occurence of a given string in bash

From Dev

Bash: How to print the filename of the nth file in a folder

From Dev

How can I print the contents of an array alongside it's position?

From Dev

How can I print the entire contents of Wordnet (preferably with NLTK)?

From Dev

How can I get the seletced filename from file button?

From Dev

How can I take input from either stdin or a file if I cannot seek stdin?

From Dev

bash print escaped file contents

From Dev

Firebase Storage Android: How can I change the the filename of a downloaded file?

From Dev

How to see the contents of a file with blank filename?

From Dev

How can I print a summary of Maildir contents when logging into a shell?

From Dev

How can I determine a file's conventional filename extension

From Dev

How to see the contents of a file with blank filename?

From Dev

How can I print contents instead of file name from using linux find command?

From Dev

How do I check if $data = file_get_contents("php://stdin") is empty?

From Dev

How can I print a newline as \n in bash?

From Dev

Bash: How to print the filename of the nth file in a folder

From Dev

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

From Dev

How can I insert the contents of a file into a string in bash

From Dev

How can I print a variable to a file?

From Dev

How can I print the filename which is being processes by xmltask?

From Dev

How can I write text to a file in bash while keeping its previous contents?

From Dev

How can I take input from either stdin or a file if I cannot seek stdin?

From Dev

bash print escaped file contents

From Dev

I have a list of files, how can I open and copy the contents of each file to a new one using bash?

From Dev

In Bash, given a sequence of files File.Number.{1..100}.txt, how can I tell which do not exist in a given directory

From Dev

How can I print the nth (5th) line of every file preceded by the FILENAME using any linux tool?

From Dev

How can I run a php file in bash by calling its filename only and not prefixing the php binary?

From Dev

How do I concatenate file contents into a single file in bash?

Related Related

  1. 1

    How can I print a newline as \n in bash?

  2. 2

    How can I get the contents of a line up to the first occurence of a given string in bash

  3. 3

    Bash: How to print the filename of the nth file in a folder

  4. 4

    How can I print the contents of an array alongside it's position?

  5. 5

    How can I print the entire contents of Wordnet (preferably with NLTK)?

  6. 6

    How can I get the seletced filename from file button?

  7. 7

    How can I take input from either stdin or a file if I cannot seek stdin?

  8. 8

    bash print escaped file contents

  9. 9

    Firebase Storage Android: How can I change the the filename of a downloaded file?

  10. 10

    How to see the contents of a file with blank filename?

  11. 11

    How can I print a summary of Maildir contents when logging into a shell?

  12. 12

    How can I determine a file's conventional filename extension

  13. 13

    How to see the contents of a file with blank filename?

  14. 14

    How can I print contents instead of file name from using linux find command?

  15. 15

    How do I check if $data = file_get_contents("php://stdin") is empty?

  16. 16

    How can I print a newline as \n in bash?

  17. 17

    Bash: How to print the filename of the nth file in a folder

  18. 18

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

  19. 19

    How can I insert the contents of a file into a string in bash

  20. 20

    How can I print a variable to a file?

  21. 21

    How can I print the filename which is being processes by xmltask?

  22. 22

    How can I write text to a file in bash while keeping its previous contents?

  23. 23

    How can I take input from either stdin or a file if I cannot seek stdin?

  24. 24

    bash print escaped file contents

  25. 25

    I have a list of files, how can I open and copy the contents of each file to a new one using bash?

  26. 26

    In Bash, given a sequence of files File.Number.{1..100}.txt, how can I tell which do not exist in a given directory

  27. 27

    How can I print the nth (5th) line of every file preceded by the FILENAME using any linux tool?

  28. 28

    How can I run a php file in bash by calling its filename only and not prefixing the php binary?

  29. 29

    How do I concatenate file contents into a single file in bash?

HotTag

Archive