Search Results

Search: Posts Made By: lyoncc
2,364
Posted By lyoncc
Fixed length fields
HPUX and posix shell

Hi all.

I have a record with fixed length fields....I would like to reorder the fields and preserver the fixed lengths....

cat test
4 960025460 Dept of Music ...
1,901
Posted By lyoncc
Number range for SSNs
Hi All.

I have a file that has an ID Number field....some of the ID Numbers are actual SSNs. ...does anyone know the range that SSNs may be...this is what I have found so far poking around SSN...
10,605
Posted By lyoncc
Hmmm
that works on my gentoo system, but it doesn't return anything on the hp

X="`cal -3 | sed -n '/29/p' | sed 's/ *$//;s/.*\([0-9][0-9]\) .*/\1/'`"
# echo $X

#
10,605
Posted By lyoncc
whoops
- HPUX POSIX Shell -


This month, the command below is returning an error...

# X=$(cal $(( ( $(date +%m) + 11 - 1 ) %12 + 1 )) $(date +%Y) | grep -v '[A-Za-z]' | wc -w)

sh: 08 + 11 - 1 )...
1,351
Posted By lyoncc
Perfect
thanks so much!!
1,351
Posted By lyoncc
sed help
Hi all!

POSIX shell on an HP.

I have a comma separated file. The first field is a numeric, with a length between 8 and 13. If the field has a length of 13, I would like to truncate the left...
10,605
Posted By lyoncc
well
that line puts 31 in X, so I guess it works! Can you explain it a bit?

Thanks very much, it seems like just what I needed.
10,605
Posted By lyoncc
Number of days in the previous month
Hi all. I am scripting in a POSIX shell on HPUX.

I am running a script that needs to determine the number of days in a month.

I found this on the forum and it works great:

X=`cal $(date...
2,208
Posted By lyoncc
Perfect!
Thanks very much Scott!!
2,208
Posted By lyoncc
awk total and print if
hi all!

I have a space delimited file...

I would like to total column 3 on the condition that column 2 is less than 1030 to a variable in my script

something like this:

TOTAL="`awk '{$2 <...
3,266
Posted By lyoncc
ok, here's my example data
|02/23/09|06:56PM|3|Plaza Cafe|Plaza2| | |VISA/MC Student | | |Y| | 7.50
|02/23/09|07:05PM|3|C/Ventana |Vent#2| | |VISA/MC Student | | |Y| | 15.77
|02/23/09|07:07PM|3|Plaza Cafe|Plaza2| | |VISA/MC...
3,266
Posted By lyoncc
whoops
I mean "last" time would be 11:59PM.
3,266
Posted By lyoncc
Thanks
the -k5 and -k3.6 work perfectly.

not sure how the -k3.1n is going to work in that the "first" time would be 12:00AM and the "last" time would be 12:59PM. Doesn't -k3.1n mean first character 0 to...
3,266
Posted By lyoncc
sort question
Hi all.

HPUX - posix shell - script question

Here's my data:
f1 f2 f3 f4 f5 f6
|02/12/09|12:33PM|3|Oceanview |OVT #1| VISA/MC ...
1,484
Posted By lyoncc
sort question
Hi all.

Is there a way that I can use the sort command too sort the following field by earliest time (12:00AM) to latest time (11:59PM)?

07:12PM
07:53PM
07:54PM
08:07PM
10:15AM
10:21AM
...
11,345
Posted By lyoncc
Replace second occurrence only
HPUX /bin/sh (posix)

I have a file as such

cat dog mouse
deer elk rabbit
mouse rat pig

I would like to replace the second occurrence of mouse in this file with mouse2. The rest of the...
11,111
Posted By lyoncc
find string, then get the next 3 lines in a file
Hi all. HPUX - /bin/sh (posix)

I am parsing a 3 field flat file, space deliminted

example data.file

acct dining mem
open 0 50
dep 50 0
close 255 0
acct plus mem
open 100 100
dep 50...
7,868
Posted By lyoncc
How to reduce font size in a file
HPUX 11iv2 #!/bin/sh

Hi all. I have a script that results in the creation of an ascii file which is ultimately emailed out to several people. The email wraps each line so I would like to reduce...
12,908
Posted By lyoncc
Whoops rounding issue
hpux 11i v2 #!/bin/sh

using the awk line below, why does $total lose it's decimal place and start rounding?????

total=`awk '{ c+=$3 }END{ print c }' test`


field 3 of test....

1106.22...
12,908
Posted By lyoncc
Thanks fellas
I first cleaned up the file by squeezing out all of the variable whitespace

cat file | tr -s " " > file.squeezed

then I used the suggested line

total=`awk '{ c+=$3 }END{ print c }'...
12,908
Posted By lyoncc
Yes you're right
I did say space delimited...that's wrong, because field 3 can be $ 0.00 or even $ 0.00. Negatives can be <$ 0.75> or <$ 0.75>. So basically, the whitespace after the $ is variable in length.
...
12,908
Posted By lyoncc
Running Total
HPUX 11i v2 #!/bin/sh

Hi all.

I have a space delimited flat file of about 9000 lines. I would like to get a running total of field 3 to the variable $TOTAL. Field 3 can be formatted as...
2,786
Posted By lyoncc
Matrix
You're Awksome!

Thanks!!!!
2,786
Posted By lyoncc
This works great, except....if VAR2 begins with A...
This works great, except....if VAR2 begins with A or 9 it doesn't print the line at all. How can I keep the the line intact if VAR2 begins with A or 9?

TIA!!!!!!!!
2,786
Posted By lyoncc
Replace var if conditon is met
HPUX 11i v2 #!/bin/sh

Hi all.

I am using a read to split a file into variables:

cat filename | while read VAR1 VAR2 ETC ETC
then a do to work each line

$VAR2 is always 9...
Showing results 1 to 25 of 31

 
All times are GMT -4. The time now is 03:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy