10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Here's my code:
awk -F '' 'NR==FNR {
if (/time/ && $5>10)
A=$2" "$3":"$4":"($5-01)
else if (/time/ && $5<01)
A=$2" "$3":"$4-01":"(59-$5)
else if (/time/ && $5<=10)
A=$2" "$3":"$4":0"($5-01)
else if (/close/) {
B=0
n1=n2;
... (2 Replies)
Discussion started by: klane
2 Replies
2. Shell Programming and Scripting
I have a large file where I want to extract the data by using awk script. I have made a small sample of the input data. I have in the awk script two condition . The first one is to collect the initial time and the second one to collect the end time. I stored the difference between (Time=end-start)... (8 Replies)
Discussion started by: ENG_MOHD
8 Replies
3. Shell Programming and Scripting
I need help to sort the output of an awk array
Example datadata="1 blue
2 green
3 blue
4 yellow
5 blue
6 red
7 yellow
8 red
9 yellow
10 yellow
11 green
12 orange
13 black"
My awk line to get output in one lineecho "$data" | awk ' {arr++; next} END { for (i in arr) { if(arr>1 )... (2 Replies)
Discussion started by: Jotne
2 Replies
4. Shell Programming and Scripting
I have this code
echo $logfile | awk ' {arr++; next} END { for (i in arr) {print i} }'
that gives me this output
result1
result2
result3
I try to figure out how to get it like this
result1 result2 result3 (4 Replies)
Discussion started by: Jotne
4 Replies
5. Shell Programming and Scripting
This code works perfect when using a machine with only one interface online. (Excluding the loopback of course) But when I have other interface up for vmware or a vpn the output gets mixed up. I know I had this working when I was just reading ip's from files so I know it is not a problem with... (8 Replies)
Discussion started by: Azrael
8 Replies
6. Shell Programming and Scripting
Hi all,
I have a script which produces a nice table but I want to sort it on column 3.
This is the output line in the script:
# Output
{ FS = ":";
format = "%11s %6s %-16s\n";
prinft "\n"
printf ( format, "Size","Count","Who" ) }
for (i in... (21 Replies)
Discussion started by: Cowardly
21 Replies
7. UNIX for Dummies Questions & Answers
I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong.
#!/usr/bin/ksh
set -A MtPtArray /u03 /u06
tUbound=${#MtPtArray
}
echo $tUbound
i=0
while ($i -lt $tUbound)
do
print... (4 Replies)
Discussion started by: KME
4 Replies
8. Shell Programming and Scripting
Hi everyone:)
I have 2 files - IN & OUT. Example:
IN
A:13:30
B:45:40
.
.
. UNLIMITED
OUT
Z:12:24
Y:20:15
.
.
. UNLIMITED
I want first row of numbers of IN - OUT. Example 13-12 45-20
My code is (2 Replies)
Discussion started by: vincyoxy
2 Replies
9. Shell Programming and Scripting
Hi,
I have a file
1:apple orange:one
2:banana:two
3:cherry:3
When I do awk -F: ' { print $2 } ' file
apple orange
banana
cherry
Now, when i redirect awk output to the file it has issue with strings
#!/bin/bash
FILEA=file
A=(`awk -F: ' { print $2 } ' $FILEA `)
echo ${A} (2 Replies)
Discussion started by: phamp008
2 Replies
10. Shell Programming and Scripting
Hi experts,
I have a the following awk command,
awk '{print $1}' /users/jon/list4.txt. The output is
123
787
888
...
...
I want to move the output to array using shell programming.
My shell is tcsh.
Is it possible to move to array using shell porg? I know its possible in... (14 Replies)
Discussion started by: amitrajvarma
14 Replies