Sponsored Content
Full Discussion: bash ls command file issue
Top Forums Shell Programming and Scripting bash ls command file issue Post 302634663 by smenago on Thursday 3rd of May 2012 04:13:31 PM
Old 05-03-2012
bash ls command file issue

Code:
ls -l /md01/EL/MarketData/inbound/ststr/INVENTORY* |tail -5 |awk '{ print $5,$6,$7,$8,$9 }'

If I run the above from the command line the output to md_email is formatted correctly as

Code:
78213497 May 1 12:50 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120430.PINESTREET.CSV.done
77904740 May 2 21:35 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120501.PINESTREET.CSV
77904740 May 2 13:05 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120501.PINESTREET.CSV.done
72218242 May 3 19:50 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120502.PINESTREET.CSV
77839922 May 3 12:50 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120502.PINESTREET.CSV.done

Code:
echo `ls -l ${indir}/${client}/CONTRACT* |tail -5 |awk '{ print $5,$6,$7,$8,$9 }'` >> $md_email

If I execute the above in a redirect to a file using a script the list does not maintain the file position -

Code:
78213497 May 1 12:50 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120430.STATESTREET.CSV.done 77904740 May 2 21:35 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120501.STATESTREET.CSV 77904740 May 2 13:05 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120501.STATESTREET.CSV.done 72218242 May 3 18:33 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120502.STATESTREET.CSV 77839922 May 3 12:50 /md01/EL/MarketData/inbound/ststr/INVENTORY.20120502.STATESTREET.CSV.done

I can't figure out if it's the file 'md_email' causing the issue or the way I am redirecting the command.

Last edited by Scrutinizer; 05-03-2012 at 05:56 PM.. Reason: some more code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bash script to delete file input on command line

1) I wrote a script and gave the desired permissions using "chmod 755 scriptname". Now if i edit the script file, why do i need to set the permission again? Didn't i set the permission attribute.. or if i edit the file, does the inode number of file changes? 2) I am running my unix on a server... (1 Reply)
Discussion started by: animesharma
1 Replies

2. HP-UX

Performance issue with 'grep' command for huge file size

I have 2 files; one file (say, details.txt) contains the details of employees and another file (say, emp.txt) has some selected employee names. I am extracting employee details from details.txt by using emp.txt and the corresponding code is: while read line do emp_name=`echo $line` grep -e... (7 Replies)
Discussion started by: arb_1984
7 Replies

3. Shell Programming and Scripting

syntax issue with quotes in mysql command for a bash script

i'm trying to write a bash script that executes a mysql statement mysql -sN -e INSERT INTO "$database"."$tableprefix"users (var1, var2,var3) VALUES (123, '1','') i don't know where to put the quotes it doesnt work with this one: ` it seems i can only put double quotes around the... (0 Replies)
Discussion started by: vanessafan99
0 Replies

4. Shell Programming and Scripting

redirect time command output to file (cygwin bash)

I have set up a bash script to run a long list of things that I need to time. I would like to redirect the output of time to a file. I have set it up like, echo "Runtimes for servlet 4, 100K structures" > test_times.txt echo "" >> test_times.txt echo "runs where N=10" >> test_times.txt echo... (7 Replies)
Discussion started by: LMHmedchem
7 Replies

5. UNIX for Advanced & Expert Users

Issue with rm command in a tera byte file system

We have a production file system which has 6+ million files with more than 1 tera byte in size. When trying to delete selective files through a weekly script files are not deleted. Please advise with ideas. (5 Replies)
Discussion started by: kppublicmail
5 Replies

6. Shell Programming and Scripting

Bash looking in different directory for file that isn't referenced in command

When I run the below bash I get the expected output, which is the sum of all matching targets less than 20 in $file1. The filename in the directory is fixed (in bold). for file1 in /home/cmccabe/Desktop/test/panel/reads/16-0000_EPIL70.txt ; do bname=`basename $file1` ... (3 Replies)
Discussion started by: cmccabe
3 Replies

7. Shell Programming and Scripting

Performance Issue for a file search command

Hi All, This query is regarding performance improvement of a command. I have a list of IDs in a file (say file1 with single ID column) and file2 has the data rows. I need to get the IDs from file1 and search in file2, matching rows from file2 should be written to a file3. For this... (4 Replies)
Discussion started by: Tanu
4 Replies

8. Shell Programming and Scripting

Reading from file bash command

Hello, I have a file in the following format id sample platform R1 R2 gene1 gene2 gene3 1 abc llumina R1_001.fastq.gz R2_001.fastq.gz apoe prnpp asp 2 def llumina R1_001.fastq.gz R2_001.fastq.gz apoe prnpp 3 ghi llumina ... (3 Replies)
Discussion started by: nans
3 Replies

9. UNIX for Beginners Questions & Answers

Bash command to find a file and print contents

I need to find a file and print its contents I am trying but it is not working find -path /opt/app-root/src/.npm/_logs -type f -name "*.log" -print Version $ bash -version GNU bash, version 4.4.12(1)-release (x86_64-pc-msys) (1 Reply)
Discussion started by: SVRao19056
1 Replies

10. UNIX for Beginners Questions & Answers

How to insert subnode in xml file using xmlstarlet or any other bash command?

I have multiple xml files where i want to update a subnode if the subnode project points to different project or insert a subnode if it doesn't exist using a xmlstarlet or any other command that can be used in a bash script. I have been able to update the subnode project if it doesn't point to... (1 Reply)
Discussion started by: Sekhar419
1 Replies
DLAGS2(l)								 )								 DLAGS2(l)

NAME
DLAGS2 - compute 2-by-2 orthogonal matrices U, V and Q, such that if ( UPPER ) then U'*A*Q = U'*( A1 A2 )*Q = ( x 0 ) ( 0 A3 ) ( x x ) and V'*B*Q = V'*( B1 B2 )*Q = ( x 0 ) ( 0 B3 ) ( x x ) or if ( .NOT.UPPER ) then U'*A*Q = U'*( A1 0 )*Q = ( x x ) ( A2 A3 ) ( 0 x ) and V'*B*Q = V'*( B1 0 )*Q = ( x x ) ( B2 B3 ) ( 0 x ) The rows of the transformed A and B are parallel, where U = ( CSU SNU ), V = ( CSV SNV ), Q = ( CSQ SNQ ) ( -SNU CSU ) ( -SNV CSV ) ( -SNQ CSQ ) Z' denotes the transpose of Z SYNOPSIS
SUBROUTINE DLAGS2( UPPER, A1, A2, A3, B1, B2, B3, CSU, SNU, CSV, SNV, CSQ, SNQ ) LOGICAL UPPER DOUBLE PRECISION A1, A2, A3, B1, B2, B3, CSQ, CSU, CSV, SNQ, SNU, SNV PURPOSE
DLAGS2 computes 2-by-2 orthogonal matrices U, V and Q, such that if ( UPPER ) then U'*A*Q = U'*( A1 A2 )*Q = ( x 0 ) ( 0 A3 ) ( x x ) and V'*B*Q = V'*( B1 B2 )*Q = ( x 0 ) ( 0 B3 ) ( x x ) or if ( .NOT.UPPER ) then U'*A*Q = U'*( A1 0 )*Q = ( x x ) ( A2 A3 ) ( 0 x ) and V'*B*Q = V'*( B1 0 )*Q = ( x x ) ( B2 B3 ) ( 0 x ) The rows of the transformed A and B are parallel, where U = ( CSU SNU ), V = ( CSV SNV ), Q = ( CSQ SNQ ) ( -SNU CSU ) ( -SNV CSV ) ( -SNQ CSQ ) Z' denotes the transpose of Z. ARGUMENTS
UPPER (input) LOGICAL = .TRUE.: the input matrices A and B are upper triangular. = .FALSE.: the input matrices A and B are lower triangular. A1 (input) DOUBLE PRECISION A2 (input) DOUBLE PRECISION A3 (input) DOUBLE PRECISION On entry, A1, A2 and A3 are elements of the input 2-by-2 upper (lower) triangular matrix A. B1 (input) DOUBLE PRECISION B2 (input) DOUBLE PRECISION B3 (input) DOUBLE PRECISION On entry, B1, B2 and B3 are elements of the input 2-by-2 upper (lower) triangular matrix B. CSU (output) DOUBLE PRECISION SNU (output) DOUBLE PRECISION The desired orthogonal matrix U. CSV (output) DOUBLE PRECISION SNV (output) DOUBLE PRECISION The desired orthogonal matrix V. CSQ (output) DOUBLE PRECISION SNQ (output) DOUBLE PRECISION The desired orthogonal matrix Q. LAPACK version 3.0 15 June 2000 DLAGS2(l)
All times are GMT -4. The time now is 07:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy