09-25-2007
Print Line numbers
Hi there,
if your trying to simply print your file with numbers on each line try this:
#!/bin/bash
set -- $( cat inputfile )
while [ "$int" -le "$lineno" ]
do
eval line=$1
echo "$int ) $line" >> usernameoutput
int=$(( $int + 1 ))
shift
done
outputt is:
1 ) aaa
2 ) bbb
3 ) ccc
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm on a Unix 5.2 server and I want to be able to see my processes to verify they are active and which processor they are running on.
ps -l will show me the status of process (active/stopped/idle)
but to see which processor the process is assigned to I don't know how.
Manpages show -o... (1 Reply)
Discussion started by: tumblez
1 Replies
2. Programming
helo i want to implement the following concept in my project
write a c/c++ algorithm for : accept a number from the user not greater than 6 digits and display the number in words i.e. if the input from the user is 18265 then the output should be Eighteen Thousand Two Hundred Sixty Five. if the... (3 Replies)
Discussion started by: amitpansuria
3 Replies
3. UNIX for Dummies Questions & Answers
Hi,
Just wonder if there is any quick way to display line number when monitoring a log file with tail -f? (4 Replies)
Discussion started by: iengca
4 Replies
4. Shell Programming and Scripting
Can anyone tell me what command would display the number of subdirectories in the current or given location? (2 Replies)
Discussion started by: jjamd64
2 Replies
5. Solaris
Hello, I am running Solaris 9 and I need to display the serial number of my machine. How can I do this?
Here is my machine info:
SunOS birch 5.9 Generic_118558-09 sun4u sparc SUNW,Sun-Fire-V240
Thank you,
David (5 Replies)
Discussion started by: dkranes
5 Replies
6. Shell Programming and Scripting
Hi,
how i can display all the unique number from my random number script below;
#!/usr/bin/perl
use strict;
my @alphanum = ( 'A' .. 'Z', 'a' .. 'z', 0 .. 9);
my $random = join('', map($alphanum,(1..5)));
print "$random\n";
Thank You. (1 Reply)
Discussion started by: malaysoul
1 Replies
7. Shell Programming and Scripting
Hey,
I guess I am just to stupid and am not seeing the "wood for the trees", but I am always getting strange errors.
I want to create a mesh with coordinates like:
x y z
3.1 3.0 0.75 0 0 1
3.1 2.9 0.75 0 0 1
3.1 2.8 0.75 0 0 1
3.1 2.7 0.75 0 0 1
3.0 ... (10 Replies)
Discussion started by: ergy1983
10 Replies
8. Shell Programming and Scripting
sorry couldnt think of a proper title lol
ok i have the following script it asks the user how many html tags they want. Im not sure how to display 2 tags if the user eneters the want only 2 tags
tags as in <p></p> or <h1></h1>
read -p "How many tags" tags1
if
then
echo "<$tags1>... (3 Replies)
Discussion started by: gangsta
3 Replies
9. Shell Programming and Scripting
Hi ,
i have a file wich have 50+ of numbers like :
0.014544106
0.005464263
0.014526045
0.005484374
0.014539412
0.005467600
0.014558349
0.005452185
i would like to display the list from the 6th bit to the end for example
0.005452185 (should become) 2185.
I've tried with ... (4 Replies)
Discussion started by: Board27
4 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I have attached an output file which is some kind of database file mapping. It is basically like an allocation mapping of a tablespace and its datafile/s.
The output is generated by the SQL script that I found from 401 Authorization Required
Excerpts of the file are as below:
... (2 Replies)
Discussion started by: newbie_01
2 Replies
LEARN ABOUT PHP
parsekit_compile_string
PARSEKIT_COMPILE_STRING(3) 1 PARSEKIT_COMPILE_STRING(3)
parsekit_compile_string - Compile a string of PHP code and return the resulting op array
SYNOPSIS
array parsekit_compile_string (string $phpcode, [array &$errors], [int $options = PARSEKIT_QUIET])
DESCRIPTION
Warning
This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in
a future release of PHP. This function should be used at your own risk.
PARAMETERS
o $phpcode
- A string containing phpcode. Similar to the argument to eval(3).
o $errors
- A 2D hash of errors (including fatal errors) encountered during compilation. Returned by reference.
o $options
- One of either PARSEKIT_QUIET or PARSEKIT_SIMPLE. To produce varying degrees of verbosity in the returned output.
RETURN VALUES
Returns a complex multi-layer array structure as detailed below.
EXAMPLES
Example #1
parsekit_compile_string(3) example
<?php
$ops = parsekit_compile_string('
echo "Foo
";
var_dump($ops);
?>
The above example will output:
array(20) {
["type"]=>
int(4)
["type_name"]=>
string(14) "ZEND_EVAL_CODE"
["fn_flags"]=>
int(0)
["num_args"]=>
int(0)
["required_num_args"]=>
int(0)
["pass_rest_by_reference"]=>
bool(false)
["uses_this"]=>
bool(false)
["line_start"]=>
int(0)
["line_end"]=>
int(0)
["return_reference"]=>
bool(false)
["refcount"]=>
int(1)
["last"]=>
int(3)
["size"]=>
int(3)
["T"]=>
int(0)
["last_brk_cont"]=>
int(0)
["current_brk_cont"]=>
int(-1)
["backpatch_count"]=>
int(0)
["done_pass_two"]=>
bool(true)
["filename"]=>
string(17) "Parsekit Compiler"
["opcodes"]=>
array(3) {
[8594800]=>
array(5) {
["opcode"]=>
int(40)
["opcode_name"]=>
string(9) "ZEND_ECHO"
["flags"]=>
int(768)
["op1"]=>
array(3) {
["type"]=>
int(1)
["type_name"]=>
string(8) "IS_CONST"
["constant"]=>
&string(4) "Foo
"
}
["lineno"]=>
int(2)
}
["859484C"]=>
array(6) {
["opcode"]=>
int(62)
["opcode_name"]=>
string(11) "ZEND_RETURN"
["flags"]=>
int(16777984)
["op1"]=>
array(3) {
["type"]=>
int(1)
["type_name"]=>
string(8) "IS_CONST"
["constant"]=>
&NULL
}
["extended_value"]=>
int(0)
["lineno"]=>
int(3)
}
[8594898]=>
array(4) {
["opcode"]=>
int(149)
["opcode_name"]=>
string(21) "ZEND_HANDLE_EXCEPTION"
["flags"]=>
int(0)
["lineno"]=>
int(3)
}
}
}
SEE ALSO
parsekit_compile_file(3).
PHP Documentation Group PARSEKIT_COMPILE_STRING(3)