Append output of a command in column wise manner
Hello!
Suppose a command generates output in every 1 hr. in form: Code:
Server1 So I want that everytime this script runs, it appends the output in next column of the file output.txt, not below the existing content. It should look like: Code:
Server1 Server1 Server1 ...... |
Quote:
Code:
#!/bin/bash |
Quote:
Sample.sh script: Code:
echo "usre1 user2" > output.txt Code:
cat output.txt |
Those are bashisms.
"$( <filename ) is a built-in shortcut that acts like "$( cat filename )" "<( command )" is process substitution "<<<word" is a here string, a simplified form of the here document. IIRC, at least some of your work is being done on a Unix box, without the availability of GNU tools, and perhaps an older version of bash? Remember to always detail the environment you're using in your posts if it's significantly different from that of a recent Linux distro. But if the tools that you use can't handle the syntax given, then you'll have to find some workaround. I don't see any problem with using text files if that's all you have available. You just need three files, used in rotation. (Note that the code below is untested) Code:
echo "user1" > "$tempfile1" |
Quote:
Quote:
|
Thanks David and ntubski! I found some really good study material at Greg's wiki.
Ciao!! |
All times are GMT -5. The time now is 07:07 PM. |