If I have a data file containing entries like-> abc abc:123
and I use a for loop:
for I in `cat data-file`
do
echo $I
done
the output would contain 2 lines -> abc.... and abc:123
but I want it to be on only one line. How can I do this?
thanks (1 Reply)
Hi Experts,
I am finding the performance of cat command is very wierd, it is taking more time to merge the files into a single file. We have a situation where we would be merging more than 100 files into a single file, but with cat command it is running slow. I tried doing with paste, join... (13 Replies)
Hi I have a simple code that I want to execute.
out=out.txt
for f in `cat list.txt | head -1`; do
echo $f >> $out
echo "sleep 5" >> $out
done
cat list.txt | head -1
wget -q -O - 'http://test.com:15100/cgi-bin/search
cat out.txt
wget
sleep 5
-q
sleep 5
-O (10 Replies)
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
I have list of files in my current directory
abc.txt
123.csv
234.csv
245.csv
145.csv
123_ex_c.sv
I don't want to open first and last file. i.e (abc.txt and 123_ex_csv)
I tried
cat *.csv, but it won't work.
Can anyone tell me the proper regex only in cat
Thanks
Pritish
... (2 Replies)
ok..
so problem is:
I have a file that reads:
cat 123
1 and 2
3 and 4
5 and 6
I was using for loops to run through this information.
Code:
for i in `cat 123`
do
echo $i
done
shouldn't the output come as
1 and 2 (3 Replies)
We have shell script (in ksh) which reads the records from a csv file line by line and does some operation. We have below command to read the file (CSV has the absolute path of files stored on a server something like SER/IMP/TEST/2010/12/123465.1).
P_FILES=`cat $P_BATCH_FILE`
for i in $P_FILES... (2 Replies)
Hi all,
I need to create loop script to read full line and append a variable to each line.
cat file
I need the output like below
10.0.0.1,136 1 24 048800 id N4 No_Light
10.0.0.1,137 1 25 048900 id N4 No_Light
10.0.0.1,140 1 28 048c00 id N4 No_Light
10.0.0.1,262 1 38 048e80... (13 Replies)
limit.csv data
--------------
5600050 38Nhava
400077 27Bomay
rate.txt data
-------------
38NhaVA
27BomaY
27Bomay
below is my script:
for i in `cat limit.csv`
do
b=`awk '{print $1}' $i` (4 Replies)
I have a script to do a couple simple but repetitive commands on files that are provided to us. One of the things is to get rid of the line feeds. This is the section that is causing problems, i even cut this section into its own file to make sure nothing else was affecting it.
#!/usr/bin/bash... (4 Replies)
Discussion started by: oly_r
4 Replies
LEARN ABOUT PHP
mssql_field_seek
MSSQL_FIELD_SEEK(3)MSSQL_FIELD_SEEK(3)mssql_field_seek - Seeks to the specified field offsetSYNOPSIS
bool mssql_field_seek (resource $result, int $field_offset)
DESCRIPTION
Seeks to the specified field offset. If the next call to mssql_fetch_field(3) won't include a field offset, this field would be returned.
PARAMETERS
o $result
- The result resource that is being evaluated. This result comes from a call to mssql_query(3).
o $field_offset
- The field offset, starts at 0.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Using mssql_field_seek(3) on the example for mssql_fetch_field(3)
<?php
// Connect to MSSQL and select the database
mssql_connect('MANGOSQLEXPRESS', 'sa', 'phpfi');
mssql_select_db('php');
// Send a select query to MSSQL
$query = mssql_query('SELECT * FROM [php].[dbo].[persons]');
// Construct table
echo '<h3>Table structure for 'persons'</h3>';
echo '<table border="1">';
// Table header
echo '<thead>';
echo '<tr>';
echo '<td>Field name</td>';
echo '<td>Data type</td>';
echo '<td>Max length</td>';
echo '</tr>';
echo '</thead>';
// Dump all fields
echo '<tbody>';
for ($i = 0; $i < mssql_num_fields($query); ++$i) {
// Fetch the field information, notice the
// field_offset parameter is not set. See
// the mssql_field_seek call below
$field = mssql_fetch_field($query);
// Print the row
echo '<tr>';
echo '<td>' . $field->name . '</td>';
echo '<td>' . strtoupper($field->type) . '</td>';
echo '<td>' . $field->max_length . '</td>';
echo '</tr>';
// Move the internal seek pointer to the next
// row in the result set
mssql_field_seek($query, $i + 1);
}
echo '</tbody>';
echo '</table>';
// Free the query result
mssql_free_result($query);
?>
SEE ALSO mssql_fetch_field(3).
PHP Documentation Group MSSQL_FIELD_SEEK(3)