Merge sorted files without knowing file names

I have a directory of gzipped files that are all sorted. I do not know how many files are in the directory. I would like to merge these files into a single file. I had been going about it like this: find . -type f | xargs zcat | sort However when I...
more »

2017-04-19 21:04 (2) Answers

Regex with find command in bash

I have been trying to use regex with find command in bash. Following are my codes: find . -regextype posix-extended -regex 'AB[0-9]{1}_all_chr\.gz' However, above code did not match to desired file with id such as "AB1_all_chr.gz" and "AB2_all_chr...
more »

2017-04-19 00:04 (1) Answers

Is it possible to pipe SVN errors?

I am writing a shell script that will run common tasks for svn repository and I need to run few svn commands that can result in error... like svn commit or svn copy What I am trying to achieve is to wrap error message to show it in specific way, but...
more »

2017-04-18 22:04 (0) Answers

Get remote name from local branch

How to get the remote name from a local branch? Note that I do not want the remote tracking branch name but just the remote name. Consider this contrived example. How do I get prefix/github? $ git status -b ## dev...prefix/github/rm/dev $ git re...
more »

2017-04-15 23:04 (2) Answers

How to use functions in bash?

I have a file which has hashes of the files against their filename. For example, fb7e0a4408e46fd5573ffb9e73aec021a9dcf426235c0ccfc37d2f5e09a68a23 /path/to/some/file 237e0a4408e46fe3573f239e73aec021a9dcf426235c023fc37d2f5e09a68a12 /path/to/another/fi...
more »

2017-04-14 14:04 (3) Answers

Bash find command

i need help to create a command. I must check if a file in a directory with a special string exists? Can anyone please help me? Until now ive got this if [ -f $plik && -d $katalog && find ]; then thank you ...
more »

2017-04-11 16:04 (0) Answers

Why does 'until' exist?

Is there any reason why the command until was implemented into bash/shell (I'm still unsure which)? Is there anything you can't do with a negation on a while statement? Is it faster than using the NOT CPU function? - unlikely... ...
more »

2017-04-10 10:04 (3) Answers

Bash script: too many arguments in [ test ]

I have the bash script below: #!/bin/bash # [ $# -eq 1 -a $1 = "--help" -o $# -eq 0 ] && { echo Help will come here } When I run it: $ ./script ./script: line 3: [: too many arguments $ ./script --help Help will come here As you can ...
more »

2017-04-09 19:04 (4) Answers

Where do piped files go on Windows?

I was experimenting with pipelines in Git Bash. I ran "ls || vim", thinking that it would open Vim with the contents of the Directory Listing written into the editor. That is not the case, and rather, it saved the file. I haven't been able to find wh...
more »

2017-04-09 18:04 (1) Answers

Linux vs. Unix file wildcards

I'm looking to get a list of files in a directory in Linux starting with a capital letter. In Unix, it's a simple ls [A-Z]* In Linux, though, I'm seeing matches that don't seem to be case-sensitive: => ls A.txt  b.txt  B.txt  c.txt  C.txt ...
more »

2017-04-07 16:04 (1) Answers

Bash find | while read - few variables

Is there a way to save output of find (few arguments) to few variables? What I need to do is take output of find and give it as input to while and use read as well. I can't use test with -r -w or -x (it's an academic exercise). Something like this: ...
more »

2017-04-05 18:04 (1) Answers

bash delete older files

I have this unique requirement of finding 2 years older files and delete them. But not only files as well as corresponding empty directories. I have written most of the logic but only thing that is still pending is , when I delete particular file fro...
more »

2017-04-04 13:04 (1) Answers