04-05-2008
Not sure why you need a loop
head -1 list.txt > out.txt
echo sleep 5 >> out.txt
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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)
Discussion started by: sleepster
1 Replies
2. UNIX for Dummies Questions & Answers
Hi
Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX?
Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies
3. Shell Programming and Scripting
cat myname.txt
John Doe I
John Doe II
John Doe III
-----------------------------------------------------------------------
for i in `cat myname.txt`
do
echo This is my name: $i >> thi.is.my.name.txt
done
-----------------------------------------------------------------------
cat... (1 Reply)
Discussion started by: danimad
1 Replies
4. Shell Programming and Scripting
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)
Discussion started by: shira
21 Replies
5. Shell Programming and Scripting
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)
Discussion started by: foal_11
3 Replies
6. Shell Programming and Scripting
Hello...
I am trying to loop through my hosts file that contains 100+ servers to check or update the nameservers on them...
My while loop is breaking after the first server responds...
#!/bin/bash
while read line; do
a=( $(echo $line | tr " " "\n") )
if }" != "" ] && }" != "#" ] &&... (1 Reply)
Discussion started by: CompSCI
1 Replies
7. Shell Programming and Scripting
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)
Discussion started by: ranjancom2000
13 Replies
8. Shell Programming and Scripting
Hi Team,
Not getting the file output inside my email which i am sending from unix box. . Please refer the below code :
#!/bin/sh
{
sleep 5
echo ehlo 10.56.185.13
sleep 3
echo mail from: oraairtel@CNDBMUREAPZP02.localdomain
sleep 3
echo rcpt to: saurabhtripathi@anniksystems.com... (1 Reply)
Discussion started by: tripathi1990
1 Replies
9. UNIX for Beginners Questions & Answers
Good day to all,
I'd like to ask for your advice with regards to this.
Scenario :
I have here a file named TEST.tmp wherein the value inside is below;
"ONE|TWO|FIVE|THREE|FOUR|SIX~SEVEN~EIGHT" "NINE"
But when I'm trying to use this in a simple command like;
for TESTING in $(cat... (4 Replies)
Discussion started by: asdfghjkl
4 Replies
LEARN ABOUT PHP
ziparchive.addfile
ZIPARCHIVE.ADDFILE(3) 1 ZIPARCHIVE.ADDFILE(3)
ZipArchive::addFile - Adds a file to a ZIP archive from the given path
SYNOPSIS
bool ZipArchive::addFile NULL (string $filename, [string $localname], [int $start], [int $length])
DESCRIPTION
Adds a file to a ZIP archive from a given path.
PARAMETERS
o $filename
- The path to the file to add.
o $localname
- If supplied, this is the local name inside the ZIP archive that will override the $filename.
o $start
- This parameter is not used but is required to extend ZipArchive.
o $length
- This parameter is not used but is required to extend ZipArchive.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
This example opens a ZIP file archive test.zip and add the file /path/to/index.txt. as newname.txt.
Example #1
Open and add
<?php
$zip = new ZipArchive;
if ($zip->open('test.zip') === TRUE) {
$zip->addFile('/path/to/index.txt', 'newname.txt');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
NOTES
Note
When a file is set to be added to the archive, PHP will lock the file. The lock is only released once the ZipArchive object has
been closed, either via ZipArchive::close or the ZipArchive object being destroyed. This may prevent you from being able to delete
the file being added until after the lock has been released.
PHP Documentation Group ZIPARCHIVE.ADDFILE(3)