New answers tagged

2

The problem with a call like this is that bad data in the packages.txt file can cause breakage. In this case you have an entry in the file -info. This means the command you are running will look like apt install pkg1 pkg2 ... -info pkg10 pkg11 ... The -info will be interpreted as an option to the apt command. It doesn't like this and so reports Command ...


0

To combine (concatenate) two files, use cat: $ cat file1 file2 >file3 This also works on gzipped files... because reasons. For example, let's say I have two Fasta files: $ gzcat file1.fa.gz >seq1 ACTACTACTACTACTACTACTACTACT $ gzcat file2.fa.gz >seq1 GATAGATAGATAGATAGATAGATAGATAAAAAAAA I combine them, without any unzipping or zipping: $ cat ...


4

As improbable as it might seem, PuTTY does this in response to a combination of characters. PuTTY recognizes many (by no means all) of the escape sequences used for xterm, Linux console and some less familiar terminals. One of PuTTY's developers compiled a list of all of the ones that might be of interest, about 650 items. You can find copies here and ...


4

What happens is that your binary happens to contain the escape sequence for setting the window title (in xterms, it's <esc>]2, I don't know if it's different in putty).


5

It doesn't show up separately in strace because it's an in-band control. Outside PuTTY, this is often noticed as corrupting the prompt. Example: Fix terminal after displaying a binary file They're called escape sequences - commands expressed as a sequence of characters, which start with the character "escape". clear is a simple example which uses them. ...


2

You can do that using command substitution, like this: more "$(perldoc -l WWW::Mechanize)" The command in parentheses will be run first in a subshell. The output will then be sent to more. The quotes are included to prevent issues with the more general case: if the output contained whitespace or globbing characters, for instance. As an example, if the ...


4

An awk script that doesn't hold either the input file, or the entire result table in memory: FNR == 1 { for(i = 1; i <= NF; i++) a[i] = $i; next } $1 == a[1] { for(i = 2; i <= NF; i++) a[i] += $i; next } { printf "%s", a[1]; a[1] = $1; for(i = 2; i <= NF; i++) { printf "\t%s", a[i]; a[i] = $i }; printf "\n"; } END { printf "%s", ...


6

They're not completely identical. In cases where it matters, the redirection approach will generally give more annoying and obscure results (of course that might be what you want though). $ cat < /proc/self/maps $ cat /proc/self/maps 55c61257e000-55c61258a000 r-xp 00000000 fd:00 1180143 /usr/bin/cat ... Or try grep, the search ...


1

In the specific case of cat, printing the file sth works just as well using cat sth or cat <sth, because the cat command was designed to either print all files given as command line parameters (the cat sth case: cat will receive the string sth as a parameter, and will open the file) or, if no files were given, print standard input instead (the cat <sth ...


5

cat's job is it to concatenate everything it gets and then to print it out on stdout yet often is used to print out the contents of a single file (which of course is just concatenating the contents of all the one files given to it and then writing it to stdout). stdout (standard output) is just programs usually write output data. (There are programs (like dd)...


-1

GNU Parallel may work for you: cat files.txt | parallel /software/Linux/itt/idl/idl81/bin/idl -e program -args {} It will default to 1 process per CPU core and it will make sure the output of two parallel jobs will not be mixed. GNU Parallel is a general parallelizer and makes is easy to run jobs in parallel on the same machine or on multiple machines ...


0

Using awk: awk '{split($2, p, "."); system(sprintf("wget -O %s.%s %s\n", $1, p[length(p)], $2))}' images.txt Break down First we use awk to print out roughly the command we want: awk '{printf("wget -O %s %s\n", $1, $2)}' images.txt Then we extract the extension by splitting the URL on '.' and append it to the first argument: awk '{split($2, p, "."); ...


3

This might do your job, while read a b do wget "$b" -O "$a".jpg printf "$a".jpg"\n%s" >> newfile done < images.txt


2

To test: $ awk '{ ext=gensub(/.*(\.[^.]*$)/,"\\1",1); print "wget " $2 " -O " $1 ext}' images.txt wget image.jpg -O some_id1.jpg wget image2.jpg -O some_id2.jpg wget image3.jpg -O some_id3.jpg To run, pipe into bash or sh like so: awk '{ ext=gensub(/.*(\.[^.]*$)/,"\\1",1); print "wget " $2 " -O " $1 ext}' images.txt | bash Add single-...



Top 50 recent answers are included