10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
trying a little bit of array scanning for open ports.
my code looks like below:
/bin/netstat -lntp|\
awk 'BEGIN { split("25 80 2020 6033 6010",q); }
$1 == "tcp" { split($4,a,":"); p]++; }
$1 == "tcp6" { split($4,a,":");p]++ }
END {
for ( i in q ) {
if (! q in p ) {... (8 Replies)
Discussion started by: busyboy
8 Replies
2. UNIX for Beginners Questions & Answers
username=cogiz
#!/bin/bash
shuffle() #@ USAGE: shuffle
{ #@ TODO: add options for multiple or partial decks
Deck=$(
printf "%s\n" {2,3,4,5,6,7,8,9,T,J,Q,K,A}{H,S,D,C} |
awk '## Seed the random number generator
BEGIN { srand() }
## Put a random number in front... (4 Replies)
Discussion started by: cogiz
4 Replies
3. UNIX for Beginners Questions & Answers
example of problem:
#!/bin/bash
P=(2 4 7)
How would you randomly choose one of these 3 numbers in this array?
either 2 or 4 or 7 is needed...but only one of them.
Thanks in advance
Cogiz
Please use CODE tags as required by forum rules! (3 Replies)
Discussion started by: cogiz
3 Replies
4. Shell Programming and Scripting
Hi All,
need help with reading the array and sum of the array elements.
given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.
Input Format
The first line of the input consists of an... (1 Reply)
Discussion started by: nishantrefound
1 Replies
5. Shell Programming and Scripting
Hello to all,
May somebody help me to fix my bash code below, I'd like to do it only using loops and if statements is possible.
I the content of the arrays are represented by the following 2 strings, where each character is an element inside the array.
String for case 1:... (10 Replies)
Discussion started by: Ophiuchus
10 Replies
6. Shell Programming and Scripting
Hi Guys,
I have an array which has numbers including blanks as follows:
1
26
66
4.77
-0.58
88
99
11
12
333
I want to print a group of three elements as a different column in a file as follows:(including blanks where there is missing elements) for.e.g. array element #7... (4 Replies)
Discussion started by: npatwardhan
4 Replies
7. Shell Programming and Scripting
I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows:
$count = 0;
while ( $count < $#test )
{
`sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`;
`cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies
8. UNIX for Dummies Questions & Answers
Hi friends how can we read array elements dynamically in bash shell? (1 Reply)
Discussion started by: haisubbu
1 Replies
9. UNIX for Advanced & Expert Users
Percent complete SCO 5.0.6 / No longer an issue (0 Replies)
Discussion started by: Henrys
0 Replies
10. Shell Programming and Scripting
Hi all,
I have a interresting problem. My application is as follows:
From a shell script i will conn to a oracle database and fetch few rows using a select statement.
Then i want to sort these rows and return a column (collection of values of a column from the selected results) as array... (3 Replies)
Discussion started by: satyakiran
3 Replies