Unix & Linux Asked by DippyDog on March 4, 2021
Write a command that
input.dat
output.dat
log.txt
I am really new to Unix and was wondering if I am using the command line parameters correctly.
My command I was writing was:
$> app < input.dat > output.dat > 2> log.txt
From what I understand is the <
reads files as standard input. >
sets files as redirection from standard output, and 2>
redirects error messages to a file.
Was wondering if my command is correct, and if not was wondering if someone could lend me a hand in this.
Depending on how the app handles its input and assuming the input data is formatted correctly you could do something like this cat input.dat | app > output.dat 2> log.txt
. The input is the part that hold most of the issues this really depends on how the app expects to receive its input ie. newline separated, tab separated ect..
You can also use the syntax you originally where trying.
app < input.dat > output.dat 2> log.txt
But personally I think the cat
method is more versatile and common usage in Linux.
Correct answer by Jason Croyle on March 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP