From 48bb5b89eca20ca1712e5a590f59387e4db03017 Mon Sep 17 00:00:00 2001 From: daniel peter Date: Tue, 23 Dec 2014 11:22:19 +0100 Subject: [PATCH] updates grep statements --- .../ACOUSTIC/run_inhomogeneous.bash | 6 +++--- .../ELASTIC/run_inhomogeneous.bash | 6 +++--- .../run_this_example.sh | 2 +- .../many_interfaces/go_process_pbs.bash | 2 +- run_this_example.sh | 2 +- utils/Cluster/go_generate_databases | 4 ++-- utils/Cluster/go_solver | 4 ++-- utils/Cluster/lsf/go_generate_databases_lsf.bash | 2 +- utils/Cluster/lsf/go_solver_lsf.bash | 2 +- utils/Cluster/lsf/run_lsf.bash | 2 +- utils/Cluster/pbs/go_decomposer_pbs.bash | 4 ++-- utils/Cluster/pbs/go_generate_databases_pbs.bash | 2 +- utils/Cluster/pbs/go_mesher_pbs.bash | 2 +- utils/Cluster/pbs/go_solver_pbs.bash | 2 +- utils/Cluster/pbs/valgrind_go_solver_pbs.bash | 2 +- utils/Cluster/sge/go_generate_databases_sge.bash | 2 +- utils/Cluster/sge/go_solver_sge.bash | 2 +- utils/cmt_frechet/go_solver_cmt | 2 +- ...ward_sources_time_reversal_Yingzi_Ying_Matlab.m | 14 +++++++------- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash b/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash index 22efbae1d..40ee641fb 100755 --- a/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash +++ b/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ACOUSTIC/run_inhomogeneous.bash @@ -3,9 +3,9 @@ echo echo `date` echo -NSTEP=`grep NSTEP ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` -DT=`grep DT ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` -NPROC=`grep NPROC ./DATA/Par_file | cut -d = -f 2 ` +NSTEP=`grep ^NSTEP ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` +DT=`grep ^DT ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` +NPROC=`grep ^NPROC ./DATA/Par_file | cut -d = -f 2 ` #daniel: echo "Par_file parameters:" diff --git a/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash b/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash index 96d792059..2f8b10f6e 100755 --- a/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash +++ b/EXAMPLES/BENCHMARK_CLAERBOUT_ADJOINT/ELASTIC/run_inhomogeneous.bash @@ -3,9 +3,9 @@ echo echo `date` echo -NSTEP=`grep NSTEP ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` -DT=`grep DT ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` -NPROC=`grep NPROC ./DATA/Par_file | cut -d = -f 2 ` +NSTEP=`grep ^NSTEP ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` +DT=`grep ^DT ./DATA/Par_file | cut -d = -f 2 | sed 's/ //g'` +NPROC=`grep ^NPROC ./DATA/Par_file | cut -d = -f 2 ` #daniel: echo "Par_file parameters:" diff --git a/EXAMPLES/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/run_this_example.sh b/EXAMPLES/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/run_this_example.sh index d5ad29561..3e5701fb5 100755 --- a/EXAMPLES/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/run_this_example.sh +++ b/EXAMPLES/homogeneous_halfspace_HEX8_elastic_absorbing_Stacey_5sides/run_this_example.sh @@ -38,7 +38,7 @@ cp DATA/CMTSOLUTION OUTPUT_FILES/ cp DATA/STATIONS OUTPUT_FILES/ # get the number of processors, ignoring comments in the Par_file -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` # decomposes mesh using the pre-saved mesh files in MESH-default echo diff --git a/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash b/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash index 999965be6..aea4813e7 100755 --- a/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash +++ b/EXAMPLES/meshfem3D_examples/many_interfaces/go_process_pbs.bash @@ -51,7 +51,7 @@ cd ../ # script to run the mesher and the solver # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | cut -d = -f 2 ` +NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 ` # total number of nodes is the product of the values read numnodes=$NPROC diff --git a/run_this_example.sh b/run_this_example.sh index e6be198cb..81bd47343 100755 --- a/run_this_example.sh +++ b/run_this_example.sh @@ -24,7 +24,7 @@ cp DATA/CMTSOLUTION OUTPUT_FILES/ cp DATA/STATIONS OUTPUT_FILES/ # get the number of processors, ignoring comments in the Par_file -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` # decomposes mesh using the pre-saved mesh files in MESH-default echo diff --git a/utils/Cluster/go_generate_databases b/utils/Cluster/go_generate_databases index f5322acf6..29cd41012 100755 --- a/utils/Cluster/go_generate_databases +++ b/utils/Cluster/go_generate_databases @@ -7,10 +7,10 @@ # name of the file that contains the list of machines set machine_file = "mymachines" -set my_local_path = `grep LOCAL_PATH DATA/Par_file | cut -d '=' -f 2 ` +set my_local_path = `grep ^LOCAL_PATH DATA/Par_file | cut -d '=' -f 2 ` # compute total number of processors needed -set NPROC = `grep NPROC DATA/Par_file | cut -d '=' -f 2 ` +set NPROC = `grep ^NPROC DATA/Par_file | cut -d '=' -f 2 ` # total number of processors is the product of the values read @ numprocessors = $NPROC diff --git a/utils/Cluster/go_solver b/utils/Cluster/go_solver index 690cfc1c5..d332a98ac 100755 --- a/utils/Cluster/go_solver +++ b/utils/Cluster/go_solver @@ -7,10 +7,10 @@ # name of the file that contains the list of machines set machine_file = "mymachines" -set my_local_path = `grep LOCAL_PATH DATA/Par_file | cut -d '=' -f 2 ` +set my_local_path = `grep ^LOCAL_PATH DATA/Par_file | cut -d '=' -f 2 ` # compute total number of processors needed -set NPROC = `grep NPROC DATA/Par_file | cut -d '=' -f 2 ` +set NPROC = `grep ^NPROC DATA/Par_file | cut -d '=' -f 2 ` # total number of processors is the product of the values read @ numprocessors = $NPROC diff --git a/utils/Cluster/lsf/go_generate_databases_lsf.bash b/utils/Cluster/lsf/go_generate_databases_lsf.bash index ea9212aca..957933137 100755 --- a/utils/Cluster/lsf/go_generate_databases_lsf.bash +++ b/utils/Cluster/lsf/go_generate_databases_lsf.bash @@ -25,7 +25,7 @@ fi # script to run the mesher and the solver # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | cut -d = -f 2 ` +NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 ` # total number of nodes is the product of the values read numnodes=$NPROC diff --git a/utils/Cluster/lsf/go_solver_lsf.bash b/utils/Cluster/lsf/go_solver_lsf.bash index 0e6323ea5..1b01704c3 100755 --- a/utils/Cluster/lsf/go_solver_lsf.bash +++ b/utils/Cluster/lsf/go_solver_lsf.bash @@ -25,7 +25,7 @@ fi # script to run the mesher and the solver # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | cut -d = -f 2 ` +NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 ` # total number of nodes is the product of the values read numnodes=$NPROC diff --git a/utils/Cluster/lsf/run_lsf.bash b/utils/Cluster/lsf/run_lsf.bash index fcf061fd3..e0ca60e4a 100755 --- a/utils/Cluster/lsf/run_lsf.bash +++ b/utils/Cluster/lsf/run_lsf.bash @@ -25,7 +25,7 @@ d=`date` echo "Finished compilation $d" # get total number of nodes needed for solver -NPROC=`grep NPROC DATA/Par_file | cut -d = -f 2 ` +NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 ` # compute total number of nodes needed for mesher NPROC_XI=`grep NPROC_XI DATA/meshfem3D_files/Mesh_Par_file | cut -d = -f 2 ` diff --git a/utils/Cluster/pbs/go_decomposer_pbs.bash b/utils/Cluster/pbs/go_decomposer_pbs.bash index 263a561c5..845d27a3e 100755 --- a/utils/Cluster/pbs/go_decomposer_pbs.bash +++ b/utils/Cluster/pbs/go_decomposer_pbs.bash @@ -23,10 +23,10 @@ cd $PBS_O_WORKDIR # script to decompose mesh # read Par_file to get information about the run -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` # path to database files for mesh -LOCALPATH=`grep LOCAL_PATH DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +LOCALPATH=`grep ^LOCAL_PATH DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` echo starting decomposer for $NPROC partitions echo " " diff --git a/utils/Cluster/pbs/go_generate_databases_pbs.bash b/utils/Cluster/pbs/go_generate_databases_pbs.bash index 1f0ca2a37..1b7d5c472 100755 --- a/utils/Cluster/pbs/go_generate_databases_pbs.bash +++ b/utils/Cluster/pbs/go_generate_databases_pbs.bash @@ -23,7 +23,7 @@ cd $PBS_O_WORKDIR # script to generate databases # read Par_file to get information about the run -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` mkdir -p OUTPUT_FILES diff --git a/utils/Cluster/pbs/go_mesher_pbs.bash b/utils/Cluster/pbs/go_mesher_pbs.bash index 633cf6448..feeccebd6 100755 --- a/utils/Cluster/pbs/go_mesher_pbs.bash +++ b/utils/Cluster/pbs/go_mesher_pbs.bash @@ -22,7 +22,7 @@ cd $PBS_O_WORKDIR # number of cores for the job -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` mkdir -p OUTPUT_FILES mkdir -p OUTPUT_FILES/DATABASES_MPI diff --git a/utils/Cluster/pbs/go_solver_pbs.bash b/utils/Cluster/pbs/go_solver_pbs.bash index f642d97e0..14a525dc9 100755 --- a/utils/Cluster/pbs/go_solver_pbs.bash +++ b/utils/Cluster/pbs/go_solver_pbs.bash @@ -24,7 +24,7 @@ cd $PBS_O_WORKDIR # script to run the solver # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` mkdir -p OUTPUT_FILES diff --git a/utils/Cluster/pbs/valgrind_go_solver_pbs.bash b/utils/Cluster/pbs/valgrind_go_solver_pbs.bash index 92f255b52..852384980 100755 --- a/utils/Cluster/pbs/valgrind_go_solver_pbs.bash +++ b/utils/Cluster/pbs/valgrind_go_solver_pbs.bash @@ -37,7 +37,7 @@ cd $PBS_O_WORKDIR # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` +NPROC=`grep ^NPROC DATA/Par_file | grep -v -E '^[[:space:]]*#' | cut -d = -f 2` mkdir -p OUTPUT_FILES diff --git a/utils/Cluster/sge/go_generate_databases_sge.bash b/utils/Cluster/sge/go_generate_databases_sge.bash index a614ca31f..6acbf2bb5 100755 --- a/utils/Cluster/sge/go_generate_databases_sge.bash +++ b/utils/Cluster/sge/go_generate_databases_sge.bash @@ -20,7 +20,7 @@ # script to run the mesher and the solver # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | cut -d = -f 2 ` +NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 ` # total number of nodes is the product of the values read numnodes=$NPROC diff --git a/utils/Cluster/sge/go_solver_sge.bash b/utils/Cluster/sge/go_solver_sge.bash index 958b7cca0..eb11b6a6d 100755 --- a/utils/Cluster/sge/go_solver_sge.bash +++ b/utils/Cluster/sge/go_solver_sge.bash @@ -20,7 +20,7 @@ # script to run the mesher and the solver # read Par_file to get information about the run # compute total number of nodes needed -NPROC=`grep NPROC DATA/Par_file | cut -d = -f 2 ` +NPROC=`grep ^NPROC DATA/Par_file | cut -d = -f 2 ` # total number of nodes is the product of the values read numnodes=$NPROC diff --git a/utils/cmt_frechet/go_solver_cmt b/utils/cmt_frechet/go_solver_cmt index 99f0d9408..6bf7c1fd4 100755 --- a/utils/cmt_frechet/go_solver_cmt +++ b/utils/cmt_frechet/go_solver_cmt @@ -4,7 +4,7 @@ # name of the file that contains the list of machines set list_of_machines = `grep MACHINE_FILE DATA/Par_file | cut -c 27- ` -set my_local_path = `grep LOCAL_PATH DATA/Par_file | cut -c 27- ` +set my_local_path = `grep ^LOCAL_PATH DATA/Par_file | cut -c 27- ` # read Par_file to get total number of processors needed diff --git a/utils/generate_SOURCE_file_forward_and_backward_sources_time_reversal_Yingzi_Ying_Matlab.m b/utils/generate_SOURCE_file_forward_and_backward_sources_time_reversal_Yingzi_Ying_Matlab.m index 6bac41780..9bcf9d39d 100644 --- a/utils/generate_SOURCE_file_forward_and_backward_sources_time_reversal_Yingzi_Ying_Matlab.m +++ b/utils/generate_SOURCE_file_forward_and_backward_sources_time_reversal_Yingzi_Ying_Matlab.m @@ -10,8 +10,8 @@ switch sourceType case 'FORWARD' -[nt_status nt] = system('grep NSTEP ../DATAs/Par_file | cut -d = -f 2'); -[dt_status dt] = system('grep DT ../DATAs/Par_file | cut -d = -f 2'); +[nt_status nt] = system('grep ^NSTEP ../DATAs/Par_file | cut -d = -f 2'); +[dt_status dt] = system('grep ^DT ../DATAs/Par_file | cut -d = -f 2'); [f_status f] = system('grep half\ duration ../DATAs/backup/CMTSOLUTION_FORWARD | cut -d : -f 2'); nt=str2num(nt); @@ -40,7 +40,7 @@ case 'BACKWARD' -[nt_status nt] = system('grep NSTEP ../DATAs/Par_file | cut -d = -f 2'); +[nt_status nt] = system('grep ^NSTEP ../DATAs/Par_file | cut -d = -f 2'); nt=str2num(nt); fid=fopen('../DATAs/backup/STATIONS_FORWARD'); @@ -63,13 +63,13 @@ totalCutTrace=zeros(cutLength,stationNumber); benchStation=floor((1+stationNumber)/2); -bench=load(['../OUTPUT_FILES/' c{1,1}{benchStation} '.' c{1,2}{benchStation} '.' band 'Z' '.' variable]); +bench=load(['../OUTPUT_FILES/' c{1,2}{benchStation} '.' c{1,1}{benchStation} '.' band 'Z' '.' variable]); [benchMax benchMaxIndex] = max(bench(:,2)); for nStation = 1:stationNumber -trace_x = load(['../OUTPUT_FILES/' c{1,1}{nStation} '.' c{1,2}{nStation} '.' band 'X' '.' variable]); -trace_y = load(['../OUTPUT_FILES/' c{1,1}{nStation} '.' c{1,2}{nStation} '.' band 'Y' '.' variable]); -trace_z = load(['../OUTPUT_FILES/' c{1,1}{nStation} '.' c{1,2}{nStation} '.' band 'Z' '.' variable]); +trace_x = load(['../OUTPUT_FILES/' c{1,2}{nStation} '.' c{1,1}{nStation} '.' band 'X' '.' variable]); +trace_y = load(['../OUTPUT_FILES/' c{1,2}{nStation} '.' c{1,1}{nStation} '.' band 'Y' '.' variable]); +trace_z = load(['../OUTPUT_FILES/' c{1,2}{nStation} '.' c{1,1}{nStation} '.' band 'Z' '.' variable]); cutTrace_x = trace_x(benchMaxIndex - cutLength/2+cutShift:benchMaxIndex + cutLength/2 -1+cutShift,2); cutTrace_y = trace_y(benchMaxIndex - cutLength/2+cutShift:benchMaxIndex + cutLength/2 -1+cutShift,2); cutTrace_z = trace_z(benchMaxIndex - cutLength/2+cutShift:benchMaxIndex + cutLength/2 -1+cutShift,2);