Linked Questions

0
votes
1answer
320 views

Copy process output few lines to a file

I want to copy the xinput-calibrator output to the temp.txt file from my Qt application. I am starting the QProcess from the Application Using the command xinput_calibrator | tee log.txt, I am ...
0
votes
1answer
241 views

the T-split command in linux as opposed to cat? [duplicate]

so for a question I have to store both messages of x and y to log, since y only exists and x does not I used cat x y &> log to be able to store both messages. However as the second part my ...
0
votes
1answer
149 views

One liner to replace file contents [duplicate]

When I run base64 filename >> encodedfile the new content is appended to existing content. Is there any way I can replace entire old content with new content. Using any similar one line ...
0
votes
1answer
415 views

Unix, create file based on command [duplicate]

I have a command, but I want to get the results into a .txt file I can open. How do I alter my command to allow the results to be put into a text file. I plan to transfer this .txt file to my local ...
0
votes
1answer
166 views

Conditionally command line export variable

If I run export COMMAND=nonexistentcommand && which $COMMAND >/dev/null || \ (echo "download filewithcommand.sh" && export COMMAND=./filewithcommand.sh) echo "command: $COMMAND" ...
0
votes
1answer
600 views

opening multiple tabs in firefox using a one-liner bash script [duplicate]

I am on CentOS 6.6. I have a program that runs analysis and outputs its data in html files. The file structure is dir1/dir1.html dir2/dir2.html dir3/dir3.html I want to open all three html files ...
0
votes
1answer
769 views

Sort file “foo” and use redirection “>” to save output into the same “foo” file [duplicate]

i have a text file ~/foo: a b c a b c i use sort foo -u, and that works correctly. I can use redirection operator ">" to save output into other file (f.e.: sort foo -u > bar), but when i want to ...
0
votes
1answer
2k views

What does this ls command do? [duplicate]

what does this command do if it was executed in my current working directory that has files in it? ls 2> result I think whatever ls writes will be redirected to the result file? Is that correct and ...
0
votes
1answer
553 views

What is the logic behind the expression cat > foo << “wordofchoice” [duplicate]

I know the > and >> operators, > puts something into a file by deleting the old content, >> appends something onto the end of the file's content. When I only use cat > foo I am able to write ...
-1
votes
1answer
130 views

just wanted to know what am i doing wrong in the end of this script that doesnt put my checkdate in to cal command

#Purpose: Validate a date #Usage: chkdate year month day # if [ $# -eq 0 ]; then echo Usage: chkdate year month day exit 0 fi year=$1; month=$2; day=$3; extra=$4 if [[ "$extra" != "" ]]...
-2
votes
1answer
68 views

What is the meaning of “<-” operator in bash? [closed]

In the installation instructions for KnockPY it says: nano knockpy/config.json <- set your virustotal API_KEY I need to understand what exact is '<-' doing in this command.
1
vote
0answers
31 views

Can't output to file with sed > [duplicate]

I'm messing around with sed for fun and have a little function I found that replaces a few characters: sed 's/"p"$/0/;s/"e"/1/' sedtext.txt Where sedtext.txt is as follows: 1, 2, 6, 7, "p" 1, 6, 7,...
0
votes
0answers
14 views

something wrong when overwriting file [duplicate]

I was trying to delete the last line and overwrite the file. But I failed for some reason. I could write the modified text to another file though. $cat > file.txt a b c $set "$d" file.txt > ...
0
votes
0answers
22 views

Explain this forking syntax [duplicate]

This is excerpted from ~/.bashrc on a RasPi. if [ -z "${SSH_TTY}" ]; then startx > /dev/null 2>&1 fi I'm fairly sure the if statement means not for ssh tty sessions ie when ...
0
votes
0answers
66 views

Why output redirection is not working? [duplicate]

Let's say I have a file named 'newfile' . Now I do some text substitution using sed command sed 's/text1/text2/' newfile > newfile In the above command I am subsituting text1 with text2 and then ...

15 30 50 per page