Tag Info

New answers tagged

0

Commands like these may help man sshfs sshfs -h 2>&1 | more # or "less", if possible


2

People usually use a pager like less to read such a long output: sshfs -h | less On less type H to show help. Q to quit. Note that you might occasionally need 2>&1 to see also additional output from stderr. For sshfs -h it has such an output so you'd better do that like this: sshfs -h 2>&1 | less Besides using a pager, on Linux text ...


6

$ cat > location/i/want/theFileImCreating cat doesn't really create files. It just writes to its standard output. In the above command, it's the output redirection (>) (set up by the shell) that creates the file (or empties an already existing one). By default, redirections (>) clobber the target if it exists. If you want to prevent that, set ...


1

In case of > eg. cat abc.txt > pqr.txt The contents of pqr.txt will be replaced with that of abc.txt In case of >> eg. cat abc.txt >> pqr.txt The contents of abc.txt will be appended with that pqr.txt at the end.


5

In zsh you can reverse the globbing order: cat access.log.*(On) ~/test % ls 1 2 3 ~/test % cat 1 1 ~/test % cat 2 2 ~/test % cat 3 3 ~/test % cat * 1 2 3 ~/test % cat *(On) 3 2 1


2

cat $( ls | tac ) or simply cat $( ls -r )


4

Try this: ls -rt access.log* | xargs cat First list the files from oldest to newest and then cat each one of them.


5

If we know the range to select, from the first line: lStart to the last line: lEnd we could calculate: lCount="$((lEnd-lStart+1))" If we know the total amount of lines: lAll we also could calculate the distance to the end of the file: toEnd="$((lAll-lStart+1))" Then we will know both: "how far from the start" ($lStart) and "how far from the ...


5

paste is probably the easiest (which is not to mention extremely efficient) means at your disposal to handle this problem. printf abc >file1 printf def >file2 paste -sd\\n file[12] abc def When paste is invoked -serially it will read each of its named input files in-turn and paste the output of each line within each file on either a <tab> or ...


1

It seems that your file1 has no trailing newline. If you want to concatenate a list of files. You can first check each one and cat a newline where needed, as follows: # make some sample files printf "%s\n" abc > file1 printf "%s" def > file2 # no trailing newline printf "%s\n" ghi > file3 printf "%s" jkl > file4 # no trailing newline ...


1

As Peter says, you first file does not have an end-of-line character. You can probably check it with ls -l --- if it's exactly three chars, this is it. If you want to "cat" the files adding a newline only if the newline wasn't there, you can use the nice trick explained here. If you have this three files: [romano:~/tmp] % ls -l f1 f2 f3 -rw-rw-r-- 1 ...


0

You have missing newlines. You could do cat file1; echo; cat file2; or create a file which has only one linebrake and do cat file1 NEWLINEFILE file2 or do this with a loop like this for i in find[1-2]; do cat $i; echo; done; to run through *, cat each file and add a newline afterwards. With $(find OPTIONS) instead of find[1-2], you could refine ...


6

grep tcp *.tcp | grep open | sort -u Giving multiple filenames to grep will, by default, cause grep to prefix the matching output lines with the filename(s) they matched in. The only other change I made was to combine sort | uniq into sort -u (and to remove the quotes that are unnecessary here).


0

grep -H 'tcp' -H, --with-filename Print the file name for each match. This is the default when there is more than one file to search.



Top 50 recent answers are included