Sponsored Content
Homework and Emergencies Homework & Coursework Questions File Looping - Looking for executable files - Need help Post 302522308 by Bob07 on Saturday 14th of May 2011 09:53:15 AM
Old 05-14-2011
Quote:
Originally Posted by ctsgnb
Could you please give us an example of expect output ?
For some reason this menu/whatever you want to call it isn't lining up no matter what I do, but the output is supposed to be:

Sequence #-------- Name--------- Size---------- Flag (yes or no)
=======-------========----=======-----============
1----------------- -File A--------- --1396---------- --Yes
2-------------------File B--------------300-------------No

This is the best I could do. The -'s there are supposed to be white space. The script needs loop through our home directory, fetch the file name, file size, and determine if the file is executable or not, flagging it as either yes or no. For each file loop the sequence # must also be provided.

The commands aren't the issue now, I've straightened those out, but I cannot get the columns to line up side by side like that. printf was the suggested command here to do all that but everything I write is being output into a single line or the file names or sizes are getting mixed up with the column name.

An example of what I'm writing is:

printf "Sequence\n=========\n%5d" $SEQ
printf "Name\n============\n%5s" $NAME
printf "Size\n=============\n%5s" $SIZE
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

looping files

Hi, I have a file a.lst which lists all files. as a.dat b.dat c.dat I want to process these files mentioned in the list file in a loop. Say I want to display only the first line of all the files a.dat , b.dat, c.dat. How can I go about it? Please help. (5 Replies)
Discussion started by: dharmesht
5 Replies

2. UNIX for Dummies Questions & Answers

Executable files

This question always confuses me :- Suppose I write a program and compile it on a machine with operating system A and processor B will the exe file run on a machine with operating system A2 but processor B operating system A but processor B2 operating system A2 and processor B2........ ... (9 Replies)
Discussion started by: nervous
9 Replies

3. Shell Programming and Scripting

Looping through files...

I posted this in the Solaris forum, but I don't think it's platform specific, so I'm posting it here. Here is the situation. We are a company that has been using a professional publishing system, the software is called "ProType". It runs on Solaris 2.4, however it is no longer supported and we... (6 Replies)
Discussion started by: Fred Goldman
6 Replies

4. UNIX for Dummies Questions & Answers

executable files

hello. My question, basically is: what is the definition of unix/linux exec files, or what makes a file executable? More specifically, must a unix source file that was compiled using gcc have exec permissions in order to be considered executable? Is it right to say that a unix/linux exec file... (1 Reply)
Discussion started by: nadavkri
1 Replies

5. Shell Programming and Scripting

Automatically select records from several files and then run a C executable file inside the script

Dear list its my first post and i would like to greet everyone What i would like to do is select records 7 and 11 from each files in a folder then run an executable inside the script for the selected parameters. The file format is something like this 7 100 200 7 100 250 7 100 300 ... (1 Reply)
Discussion started by: Gtolis
1 Replies

6. Shell Programming and Scripting

looping through files

I am writing a ksh which has to load 7 files(.dat files) from input directory into oracle tables using sql loader. The process has to take each file at a time and once if it is loaded succesfully using sql loader into oracle tables then the process has to pick next file and load it into oracle... (2 Replies)
Discussion started by: vpv0002
2 Replies

7. UNIX for Dummies Questions & Answers

looping through file and creating seperate files

Hi, My first post!! I have a files with header, something like this Header_Row AMC|D1|D2|D2 AAO|D3|D4|D5 AMC|D6|D7|D8 AAO|D9|D10|D11 . . . . . and millions fo records thereafter like this. I want to read the above file in a loop and write the lines having AMC into another... (1 Reply)
Discussion started by: amitbakre
1 Replies

8. Shell Programming and Scripting

While or For with looping contructs? to create files from contents of a text file

Hi so far I created this script: vi loop.beta.sh for i in `cat extract.filenames.tabc` do echo $i done>$i === This is the original text file. $ more tabc.txt -rwx------- 1 alice staff 1586 2010-11-05 02:27 request-key .conf -rwx------- 1 ted staff 126 ... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

9. Shell Programming and Scripting

Looping the files for getting the file size information

Am using Linux 3.10 years.txt is input source file which has the list of year like below 2013 2014 2015 2016 Other Input files are XX_TEST1_YR2016_01012018.csv XX_TEST1_YR2015_01012018.csv XX_TEST1_YR2014_01012018.csv XX_TEST1_YR2013_01012018.csv XX_TEST2_YR2016_01012018.csv... (2 Replies)
Discussion started by: weknowd
2 Replies
MAXDB_FETCH_FIELD_DIRECT(3)						 1					       MAXDB_FETCH_FIELD_DIRECT(3)

maxdb_fetch_field_direct - Fetch meta-data for a single field

       Procedural style

SYNOPSIS
mixed maxdb_fetch_field_direct (resource $result, int $fieldnr) DESCRIPTION
Object oriented style mixed maxdb_result::fetch_field_direct (int $fieldnr) maxdb_fetch_field_direct(3) returns an resource which contains field definition information from specified resultset. The value of fieldnr must be in the range from 0 to number of fields - 1. RETURN VALUES
Returns an resource which contains field definition information or FALSE if no field information for specified fieldnr is available. Object attributes +-----------+---------------------------------------------------+ |Attribute | | | | | | | Description | | | | +-----------+---------------------------------------------------+ | name | | | | | | | The name of the column | | | | |max_length | | | | | | | The maximum width of the field for the result | | | set. | | | | | type | | | | | | | The data type used for this field | | | | | decimals | | | | | | | The number of decimals used (for integer fields) | | | | +-----------+---------------------------------------------------+ EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT name, cno from hotel.customer ORDER BY name"; if ($result = $maxdb->query($query)) { /* Get field information for column 'SurfaceArea' */ $finfo = $result->fetch_field_direct(1); printf("Name: %s ", $finfo->name); printf("Table: %s ", $finfo->table); printf("max. Len: %d ", $finfo->max_length); printf("Flags: %d ", $finfo->flags); printf("Type: %d ", $finfo->type); $result->close(); } /* close connection */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $query = "SELECT name, cno from hotel.customer ORDER BY name"; if ($result = maxdb_query($link, $query)) { /* Get field information for column 'cno' */ $finfo = maxdb_fetch_field_direct($result, 1); printf("Name: %s ", $finfo->name); printf("Table: %s ", $finfo->table); printf("max. Len: %d ", $finfo->max_length); printf("Flags: %d ", $finfo->flags); printf("Type: %d ", $finfo->type); maxdb_free_result($result); } /* close connection */ maxdb_close($link); ?> The above example will output something similar to: Name: CNO Table: max. Len: 4 Flags: -1 Type: 0 SEE ALSO
maxdb_num_fields(3), maxdb_fetch_field(3), maxdb_fetch_fields(3). PHP Documentation Group MAXDB_FETCH_FIELD_DIRECT(3)
All times are GMT -4. The time now is 07:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy