Sponsored Content
Top Forums Shell Programming and Scripting Issues in reading file using 'awk' Post 302781387 by emily on Saturday 16th of March 2013 12:34:59 PM
Old 03-16-2013
Hi Don,
Yup, it is working..Thanks Don...Smilie Smilie

May I ask another query, which is following:
I want the script to look for all directories within that particular directory and perform
crab task , get the jobNo...
At present, I have following directory where I want to perform these operation:
Code:
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:42 qcd800
-rw-r--r-- 1 emily04 us_cms   9739 Mar 15 11:42 VgAnalyzerKitDemoMC52X_AOD.pyc
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:43 qcdEm40
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:44 GJet20To40
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:46 qcd1000
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:47 qcd120
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:48 GJet40ToInf
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:49 qcd1400
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:51 qcd50
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:52 qcd1800
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:53 qcd30
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:54 qcd80
drwxr-xr-x 6 emily04 us_cms   2048 Mar 15 11:55 qcdEm30To40

But also,I am afraid sometime they does not have any parriculer pattern, for example another set of dorectories which
i have are following:
Code:
 
drwxr-xr-x 6 emily4 us_cms  2048 Mar 15 10:32 tt
drwxr-xr-x 6 emily04 us_cms  2048 Mar 15 10:33 zgamma
drwxr-xr-x 6 emily04 us_cms  2048 Mar 15 10:34 DiPhoJet
drwxr-xr-x 6 emily04 us_cms  2048 Mar 15 10:35 DYJets50

Can I define some kind of 'array' declaring the directories name and 'loop' to run over them?

Thanks in advance.
emily

---------- Post updated at 11:34 AM ---------- Previous update was at 10:01 AM ----------

Hi again,
I could perform the array based execution of the commands. Thanks all
for your kind help.

What I did is following:
Code:
GREP="qcd30"
GREP=""QCD50"
for file in "${GREP[@]}"
do
      crab ntuplize_crab -getoutput -c $FileNameIndx
done

But while doing this, it come to my mind if I can perform parallel execution of the different GREP[] ?
Is it doable?

greetings,
emily

Last edited by emily; 03-16-2013 at 12:11 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading large file, awk and cut

Hello all, I have 2 files, the first (indexFile1) contains start offset and length for each record inside the second file. The second file can be very large, each actual record start offset and length is defined by the entry in indexFile1. Since there are no records separators wc-l returns 0 for... (1 Reply)
Discussion started by: gio001
1 Replies

2. Shell Programming and Scripting

Using awk to when reading a file to search and output to file

Hi, I am not sure if this will work or not. I am getting a syntax error. I am reading fileA, using an acct number field trying to see if it exists in fileB and output to new file. Can anyone tell me if what I am doing will work or should I attempt it another way? Thanks. exec < "${fileA}... (4 Replies)
Discussion started by: ski
4 Replies

3. Shell Programming and Scripting

Reading a file several times with awk

Hi everyone, I was wondering if it's possible to read a file ("file2" in my example) more than once. In this example I want to print file2 entirely for each lines of file1: awk -F$'\t' '{ print $0 while ((getline < "file2") > 0) { print "\t"$0 } }' file1 It... (4 Replies)
Discussion started by: anthony.cros
4 Replies

4. Shell Programming and Scripting

Issues with Reading Line by line from a file

I am trying to read a host name one at a time from a file which has a list of hostnames and do rsh and print . its not looping through the entire file. its breaking out after the first entry. If i comment out the rsh then it loops through file #!/bin/ksh filename="/tmp/hostnames"; while read -r... (11 Replies)
Discussion started by: SMunje
11 Replies

5. Shell Programming and Scripting

awk- reading input file twice

Hello, I've been trying to come up with a solution for the following problem; I have an input file with two columns and I want to print as an output the first column without any changes but for the second column, I want to divide it by its last value. Example input: 1 9 2 10 3 11 4 12 5... (14 Replies)
Discussion started by: acsg
14 Replies

6. Shell Programming and Scripting

awk file reading doubt

Hi, Using this trivial code, I am trying to insert/paste the single column data of a file into the second column (field 2) of a multi-column text file. awk 'FNR==NR {a=$0; next} {$1=$1 OFS a}1' single-column-file multi-column-file Lets consider the single-column-file as 'f2' and multi-column... (1 Reply)
Discussion started by: royalibrahim
1 Replies

7. Shell Programming and Scripting

reading file awk or while

While read line query !!! Folks, I am working on a file which has entries as follows. I am using while read line to generate desired output as follows. filename1: Name : sdt2156157_ID NOS : 4567 NOS : 2348 Name : sdt2156158_ID NOS : 4987 NOS :... (3 Replies)
Discussion started by: dynamax
3 Replies

8. Shell Programming and Scripting

awk issue while reading from file in while do

Hi Friends, I am trying to scan line by line using awk and pull the values and pass it in variables and then will use the variables but doesn't work. Please see below for details. #more dbtest.sh ---------------------------------- #!/bin/bash . $HOME/.bash_profile while read line do... (6 Replies)
Discussion started by: narunice
6 Replies

9. Shell Programming and Scripting

Reading data from file using awk

I have a file as below. It contains two data sets separated by >. I want to pipe each data set to another program called psxy. How can I get the different records Have started doing as follows but it only passes the first data set awk 'BEGIN {RS=">"};{print $0}' p.dat cat p.dat... (12 Replies)
Discussion started by: kristinu
12 Replies

10. Shell Programming and Scripting

Awk: File Checking Issues with 9 multiple file

Hi, I have 9 files which are generated dynamically & if there is a some condition which doesn't meet the criteria then file is not created or is of zero size. so further i am unable to consolidate the files based on following code 1 awk -F, -v ptime="201407" 'FNR==1... (3 Replies)
Discussion started by: siramitsharma
3 Replies
vdltodmx(1)						      General Commands Manual						       vdltodmx(1)

NAME
vdltodmx - dmx configuration file parser and printer SYNOPSIS
vdltodmx infile outfile DESCRIPTION
vdltodmx reads the input file, which should be in VDL configuration file format. After a successful parse, a file in Xdmx configuration file format is written to the output file. The VDL file format is used with xmovie, which is available from http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html EXAMPLE
Given the following VDL-format file: 0 2 # # 2560 2048 Left two-thirds [restrict=*:2] 2 :2.1 1280 2048 0 0 0 0 :2.2 1280 2048 1280 0 0 0 4 1280 1024 0 0 1280 1024 0 1024 1280 1024 1280 0 1280 1024 1280 1024 # 2560 2048 Right two-thirds [restrict=*:2] 2 :2.2 1280 2048 0 0 0 0 :2.3 1280 2048 1280 0 0 0 4 1280 1024 1280 0 1280 1024 1280 1024 1280 1024 2560 0 1280 1024 2560 1024 the following DMX-format file will be produced: # # virtual "Left two-thirds" 2560x2048 { display :2.1 1280x2048; display :2.2 1280x2048 @1280x0; } # virtual "Right two-thirds" 2560x2048 { display :2.2 1280x2048; display :2.3 1280x2048 @1280x0; } BUGS
If the VDL file is not in the expected format, the program will probably dump core. SEE ALSO
Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1) X Version 11 xorg-server 1.12.4 vdltodmx(1)
All times are GMT -4. The time now is 02:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy