Hello,
I have 800 or so files with 3 columns each and >10000 lines each.
For each file and each line I would like to print the maximum column number for each line. Then I would like to 'paste' each of these files together (column-wise) so that the file with expression in label '_1' is the... (6 Replies)
Hi All,
I am performing addition of two inetger variables which assigning output to a new variable getting following error.
Check1.sh
#!/bin/ksh
filesrc=/usr/kk/Source1.txt
filetgt=/usr/kk/Source2.txt
FINAL_COUNTS= `awk '{n++} END {printf "%012d\n",n}' ${filesrc} ${filetgt}`... (3 Replies)
Hi All,
I want to pass few dynamic arguments to shell script. The number of arguments differ each time I call the script.
I want to print the arguments using the for loop as below. But not working out.
for (( i=1; i<=$#; i++ ))
do
echo $"($i)"
done
/bin/sh test.sh arg1 arg2 arg3
... (1 Reply)
Hi ,
i want to print the output in line by line
while read LINE
do
echo $LINE | grep UCM | egrep '(Shutdown|Unavailable)'
echo $LINE | grep SRBr | egrep '(Shutdown|Unavailable)'
echo $LINE | grep SRP| egrep '(Shutdown|Unavailable)'
echo $LINE | grep OM | grep JMS|... (7 Replies)
Hi,
I am trying to print copy percentage completion dynamically by using the script below,
#!/bin/bash
dest_size=0
orig_size=`du -sk $sourcefile | awk '{print $1}'`
while ; do
dest_size=`du -sk $destfile | awk '{print $1}'`
coyp_percentage=`echo "scale=2; $dest_size*100/$orig_size"... (4 Replies)
In the bash below I am trying to loop through all the R1.gz in a directory (always 1), store them in ARRAY, and cut them before the second _. That is being done but I can't seem to print then one a single line seperated by a space. Is the below the best way or is there a better solution? Thank you... (3 Replies)
I am unable to loop print a python string array in my unix shell script:
~/readarr.sh '{{ myarr }}'
more readarr.sh
echo "Parameter 1:"$1
MYARRAY= $1
IFS=
MYARRAY=`python <<< "print ' '.join($MYARRAY)"`
for a in "$MYARRAY"; do
echo "Printing Array: $a"
done
Can you... (10 Replies)
Currently using below script but echo it print the output in two line.
Input file all-vm-final-2.txt
CEALA08893 SDDC_SCUN DS_SIO_Workload_SAPUI_UAT_01 4
CEALA09546 SDDC_SCUN DS-SIO-PD5_Workload_UAT_SP1_Flash_07 4
CEALA09702 SDDC_SCUN DS-VSAN-RMP-WORKLOAD01 4
DEALA08762 SDDC_LDC... (3 Replies)
Discussion started by: ranjancom2000
3 Replies
LEARN ABOUT PHP
readdir
READDIR(3) 1 READDIR(3)readdir - Read entry from directory handleSYNOPSIS
string readdir ([resource $dir_handle])
DESCRIPTION
Returns the name of the next entry in the directory. The entries are returned in the order in which they are stored by the filesystem.
PARAMETERS
o $dir_handle
- The directory handle resource previously opened with opendir(3). If the directory handle is not specified, the last link opened
by opendir(3) is assumed.
RETURN VALUES
Returns the entry name on success or FALSE on failure.
Warning
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on
Booleans for more information. Use the === operator for testing the return value of this function.
EXAMPLES
Example #1
List all entries in a directory
Please note the fashion in which readdir(3)'s return value is checked in the examples below. We are explicitly testing whether the
return value is identical to (equal to and of the same type as--see Comparison Operators for more information) FALSE since other-
wise, any directory entry whose name evaluates to FALSE will stop the loop (e.g. a directory named "0").
<?php
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle
";
echo "Entries:
";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
echo "$entry
";
}
/* This is the WRONG way to loop over the directory. */
while ($entry = readdir($handle)) {
echo "$entry
";
}
closedir($handle);
}
?>
Example #2
List all entries in the current directory and strip out . and ..
<?php
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "$entry
";
}
}
closedir($handle);
}
?>
SEE ALSO is_dir(3), glob(3), opendir(3), scandir(3).
PHP Documentation Group READDIR(3)