Search This Blog

Thursday, May 23, 2013

How to make DHDall.xyz

#!/bin/bash

DHDfile=($(ls -1 DHD?????.xyz))  # Read all files of DHD?????.xyz
interval=$1        # Interval is the first argument.
: ${interval:=1}   # If there is no argument, default value is 1.


if [ -f DHDall.xyz ] # If DHDall.xyz exist
then
   rm DHDall.xyz     # then delete it.
fi
touch DHDall.xyz     # As DHDall.xyz is absent, touch it.

for (( i=0; i < ${#DHDfile[@]} ; i=i+$interval )) do
   cat  ${DHDfile[$i]} >> DHDall.xyz
done
exit








No comments:

Labels