I need to create 26 files named a to z in single command. I thought touch command would be sufficient with the regex, but it doesn't expand [a-z] instead it creates a single file with name "[a-z]".  $ touch [a-z]   Any way to achieve these?  Note:   $ bash -version  GNU bash, version 4.3.30(1)-release (i686-pc-linux-gnu)
120566
I know with mkdir I can do mkdir A B C D E F to create each directory.  How do I create directories A-Z or 1-100 with out typing in each letter or number?
2306
I am writing a bash script to look for a file if it doesn't exist then create it and append this to it:  Host localhost     ForwardAgent yes   So "line then new line 'tab' then text" I think its a sensitive format.  I know you can do this:  cat temp.txt &gt;&gt; data.txt   But it seems weird since its two lines. Is there a way to append that in this format:  echo "hello" &gt;&gt; greetings.txt
114806
I want to rename multiple files in the same directory using Bash scripting. Names of the files are as follows:  file2602201409853.p file0901201437404.p   file0901201438761.p   file1003201410069.p   file2602201410180.p   I want to rename to the following format:  file2503201409853.p file2503201437404.p   file2503201438761.p   file2503201410069.p   file2503201410180.p   I was reading about the rename command, and try to do it this way, but it does nothing, I think I have questions about the syntax. Then I read that you can make a loop using the  command as follows:  for file in cmpsms*2014*.p; do     mv "$file" "${file/cmpsms*2014*.p/cmpsms25032014*.p}" done   But I can not rename the files. What am I doing wrong?
89696
I want create empty files with the same name, but in another location.  Is it possible?   find some files use only filenames touch an empty file in another place   Something like this:  find . -type f -name '*.jpg' -exec basename {}.tmp | touch ../emptys/{} \;
74914
Is there a command to create multiple ZIP files based on file size? So that in a folder of 600 files, totalling 1 GB, the command will create 4 zips roughly equal to 250mb.  There's a similar command . But it ZIPs files according to a file number limit.  I also don't want the resulting zip files to be connected with each other, so that I can open them individually and won't need to open all of them at the same time.
106744
In bash, {a..d} expands to a b c d. Currently this is not happening for me in zsh, and my googling has returned conflicting results.  Some results suggest that {a..d} should work -  The other result I found is from the zsh mailing list which suggests setopt braceccl to get letter ranges using {a-z}. This works, but I'm wondering whether I've misread the Brace-Expansion link, or whether there's something else to consider.  Importantly, I'm using the zsh-grml config, which is probably adjusting a variety of expansion options, but I'm hesistant to start digging through because it's massive, and a cursory grep brace ~/.zshrc doesn't reveal anything.
74869
I need to rename files names like this  transform.php?dappName=Test&amp;transformer=YAML&amp;v_id=XXXXX   to just this  XXXXX.txt   How can I do it?  I understand that i need more than one mv command because they are at least 25000 files.
8293
Possible Duplicate:          Using \input{filename}, I can input a file canned "filename.tex". I have a directory containing all of the files I want to include. How can I create a for loop, which inputs all of those files?   The contents of the directory sometimes changes (so I do not want to manually specify all of the files). The files are numbered (e.g. file01.tex, file02.tex), so the loop should have no difficulty inputing them in the correct order. Other code will be placed within the for loop (before and after the input command), so I do not want to simply list all of the files at once (e.g. \input{file01,file02}).
23751
I want to create a simple bash-script that checks whether a directory contains all the files whose names contain numbers from 1 to N.  # Creating some files for testing $ cd /tmp/ $ mkdir test $ touch test/a01x.dat $ touch test/b02y.dat  # Display dir contents $ ls test/*{01,02}* test/a01x.dat  test/b02y.dat   But using seq command to generate numbers results in the following:  $ ls test/*{$(seq -s , -f "%02g" 1 2)}* ls: cannot access 'test/*{01,02}*': No such file or directory   I understand that running the command by surrounding the path with single quotation marks must lead to the error because the wildcards don't expand  $ ls 'test/*{01,02}*'   But I didn't use them. What is the problem?
45736
In response to a comment of mine to  on SF the OP asserts that the   for i in {1..$NUM}   expands correctly in bash. I have access to bash 4.0.33 (Ubuntu), 3.2.25 (Centos) and 3.00.16(1) (solaris 10). None of these will expand the {1..$NUM}.   Does anyone know which versions of bash do the expansion? If it's not bash what is it ? I know zsh will do the expansion but in the OP's script the shebang should remove the possibility of an alias ?
103456
I want to create a shell script that deletes old release files except last n files. In other words, only mantain last n releases when I deploy a new release.  File names have this format:  appname_releasenumber_date.tar.gz   Maybe there's an easy soluction to do this, but I cannot figure out how to do this.   I've found this solution  but I need to generate some files first in order to keep the number of files I want to.
41314
I am looking for a regular expression that finds all occurences of double characters in a text, a listing, etc. on the command line (Bash).  Main Question: Is there a simple way to look for sequences like aa, ll, ttttt, etc. where one defines a regular expression that looks for n occurences of the same character with? What I am looking for is achieving this on a very very basic level. On the command line. In a Linux Shell.  After quite some research I came to the following answers &ndash; and questions resulting from them, thus they just gave me a hint where the solution might be. But:  a) (e)grep and the backslash issue   grep 'a\{2\}' looks for aa egrep'a{2}' looks for aa   Question: Is the necessity of setting backlashes really bound to the command I use? If so, can anyone give me hint what else is to be taken into account when using (e)grep here?  b) I found  for my question, though it isn't exactly what I was looking for:  grep -E '(.)\1' filename looks for entries with the same character appearing more than once but doesn't ask how often. This is close to what I am looking for, but I still want to set a number of repeatings.  I probably should split this into two or more questions, but then I don't want to flood this awesome site here.   P.S.: Another question, possibly off topic but: is it in, inside, at or on the shell. And is on the command line correct?
55389
Is there a way to zip all files in a given directory with the zip command? I've heard of using *.*, but I want it to work for extensionless files, too.
11740
I'm running tests of a variable-size-and-contents test set. Data files are added and removed frequently. I'm looking for an automated way of gathering a file list.  All files are in subdirectories of D; I need the full directory and name added to a text file. However, I only need those files that have a "paired" file, which has the same filename but a different extension (so... different filename, but in a structured way). So, if there is a MyFileName.A and MyFileName.B, then I want D/.../MyFileName added to the file list.  There are .A files without .B files, but no .B files without .A files. If a .A has a .B file, then both files are in the same directory.   Any advice?
74110
I am trying to rename a bunch of files according to the names of their directory in Linux, SSH.  I have a directory called XYZ01smith. In it are four files called smith_5*.I need to add prefix XYZ01 to these files. But, the next directory is called XYZ02perry. In it are four files called perry_3*. I need to add the prefix XYZ02 to these files.  I have a loop to do this per directory:  for i in smith_5*;     do mv ${i} XYZ01${i}; done    But I have 50 directories (XYZ01name to XYZ50name), so I would rather be able to do this with one script for all 50. I am sure this should be possible, but I do not know how.
94295
A long time ago I remember using a command that makes its input into a nicely formatted table.  For example, for this input,  apple 1 100 orange 20 19 pineapple 1000 87 avocado 4 30   The output will be similar to this:  apple     1    100 orange    20   19 pineapple 1000 87 avocado   4    30   I'd like to know the name of this tool.
13709
I need to rename the following:  file_001_loremipsum.png file_002_dolor.png file_003_sit.png file_004_amet.png file_105_randomness.png   into  upl_loremipsum.png upl_dolor.png upl_sit.png upl_amet.png upl_randomness.png   How do I make it happen with just one simple line of terminal command?