How do I put Output command telnet in file [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
How do I put Output command telnet in file ?
telnet www.google.com 80 > file.txt
GET / /HTTP/1.1
Why am I wrong?

It's correct...I don't know why its not work, but you can use tee to.
command | tee ~/outputfile.txt
A slight modification will catch stderr as well:
command 2>&1 | tee ~/outputfile.txt
or just the same with less characters to type:
command |& tee ~/outputfile.txt
tee is useful if you want to be able to capture command output while also viewing it live.

Related

cat not numbering lines of version output [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 months ago.
Improve this question
When I type echo Hello$'\n'world | cat -n I get the output as expected:
1 Hello
2 world
But if I want to number line of g++ -v | cat -n I get an unnumbered result.
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
...
What's wrong with my command?
The output of g++ -v goes to the standard error, not standard output. Redirect stderr to stdout to process it in a pipeline:
g++ -v 2>&1 | cat -n

Fill in command input [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I'm trying to enter input without typing anything I'm trying to put the input in the command.
I've seen people try this:
printf 'argument\n' | command
Or
command <<< "argument\n"
I don't know if what I'm doing is command specific but neither of these work for what I'm trying to do.
I'm trying to zip a file with a password:
zip -r -e test.zip test_zip/
-e is for password input (this isn't the part I was talking). I set the password to test1234.
When I unzip the file I try things like this:
printf 'test1234\n' | unzip test.zip
But it still asks for password input.
Any suggestions?
If you are using the Linux command line, try using echo.
echo 'test1234' | unzip test.zip
Use the -P argument
unzip -P <password> <zipfile>

Transferring file using SCP command fails with relative path and works with absolute path [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
This is failing. (the file.txt is in the same folder)
sudo scp file.txt shahid#11.34.45.23:~/
#gives error Permission denied (publickey).
The following works, however, it asks for the local machine password
sudo scp me#localhost:/home/file.xt shahid#11.34.45.23:~/
If the file.txt doesn't contain any critical data, change its permissions to allow reading by others:
$ sudo chmod 744 file.txt
And then try the scp.

Using linux pipe output as partial input [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
Running a grep command on my file gives me the following output:
15-5-65
52-5-93
51-4-82
21-0-86
54-6-09
63-2-68
26-7-85
24-9-46
16-7-59
81-5-42
31-7-63
54-0-84
69-8-80
74-1-27
19-9-86
41-8-74
13-2-03
21-3-61
56-7-60
81-9-47
I want to use each of these as a partial input to another grep command, such as grep '02729-AS-27' maps/projects.dat | grep '...-...' circuit_(pipe input).dat How do I properly format this command?
If this isn't clear, the files I want to search are called for example circuit_81-5-42.dat with numbers corresponding to the output of the first grep command above.
I hope this is what you want:
while IFS= read -r line; do
grep "...-..." "circuit_${line}.dat"
done < <(grep "02729-AS-27" "maps/projects.dat")
Or:
grep "02729-AS-27" "maps/projects.dat" | xargs -i grep "...-..." "circuit_""{}"".dat"
Please replace the pattern ...-... with the appropriate one.
Hope this helps.

Shuf - To Shuffle the contents of a file in linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am using some tcsh code that uses a command called shuf:
shuf $file_name > out.txt
http://tuxthink.blogspot.ca/2012/06/shuf-to-shuffle-contents-of-file.html
but seems my linux/bash version does not have it. Does anyone knows a way to install it?
My linux/tcsh is:
$ echo $version
tcsh 6.14.00 (Astron) 2005-03-25 (x86_64-unknown-linux) options wide,nls,dl,al,kan,sm,rh,color,filec
$ uname -mrs
Linux 2.6.18-194.8.1.el5 x86_64
Also, I am a user of the server but I do not have super user permission, can only perform local installations in my user folder.
Thanks!
Try your package manager or sudo apt-get install shuf

Resources