Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Parsing a variable length record Post 56322 by Barb on Thursday 30th of September 2004 03:59:45 PM
Old 09-30-2004
Thought I would share the final product with you. This is giving the company what it needed. I know my coding leaves alot to be desired and any critiques are welcome. I'm just learning again and I can usually get it accomplished - but it ain't pretty. Thanks again for all your help!

#VARIABLES
DATE=$(date +%y%m%d)
TIME=$(date +%T)

# Move today's files into the current directory
cp /lawprd/law/logan/edi_arch_inb/GMED*$DATE* .

# Join all of todays files together
cat GMED*$DATE* > GMED.wrk

#prt header on top of missing540.lst file
echo "$DATE $TIME" > missing540.lst
echo "" >> missing540.lst
echo " Missing GMED Records Report: $TIME" >> missing540.lst
echo "----------------------------------------------" >>missing540.lst

sed -n '/\~ST\^/{N;s/\n//;s/.*\~ST\^//p;}' < GMED.wrk | awk -F "^" '/856\^/ { print $4 }' >ponumber
sed -n '/\~ST\^/{N;s/\n//;s/.*\~ST\^//p;}' < GMED.wrk | awk -F "^" '/810\^/ { print $6 }' >>ponumber

#Pull the requisition numbers out of the MA540CSV file
awk -F "," '/,H,/ { print $10 }' /lawprd/law/prod/work/MA540CSV/MA540CSV >csvnums

#Resort the files and remove duplicate records
sort -u ponumber >po2
sort -u csvnums >csv2

#Write the differences between the inbound and the csv and send them out to a file.
diff po2 csv2 | awk '{if( $2 != "") print $2}' >>missing540.lst

#Remove all the GMED files from the current directory
rm GMED*

#Send the output to cypress
qprt -p17 -z1 -Pcypresst missing540.lst
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing data and retaining the full length of variable

Here's is an example of what I want to do: var1="Horse " var2="Cat " var3="Fish " for animals in "$var1" "$var2" "$var3" do set $animals pet=$1 ## Ok, now I want to get the values of $pet, but ## I want to retain the full length it was... (3 Replies)
Discussion started by: app4dxh
3 Replies

2. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

3. Shell Programming and Scripting

Pivot variable record length file and change delimiter

Hi experts. I got a file (500mb max) and need to pivot it (loading into ORCL) and change BLANK delimiter to PIPE |. Sometimes there are multipel BLANKS (as a particular value may be BLANK, or simply two BLANKS instead of one BLANK). thanks for your input! Cheers, Layout... (3 Replies)
Discussion started by: thomasr
3 Replies

4. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

5. Shell Programming and Scripting

Parsing a variable length file

Hi I am new to shell scripting. I need to parse a file which contains the header and detail records and split into n of file based on dept ID, for ex. INPUT FILE: DEPT ID: 1 EMPNAME: XYZ EMPAddress: XYZZZ DEPT ID: 2 EMPNAME: ABC EMPAddress: ABCD DEPT ID: 1 EMPNAME: PQR EMPAddress:... (6 Replies)
Discussion started by: singhald
6 Replies

6. Shell Programming and Scripting

Check length of record

Hi, I have a problem, please help me, I have a flat file like this: P00000000088888888999999999 0000999903 000000000000000000 P00000000077777777000000000 0000999903 000000000000000000 P00000000044444444333333333 0000999903 00000000000000000079875 P00000000066666666111111111 0000999903 ... (5 Replies)
Discussion started by: DebianJ
5 Replies

7. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

8. Shell Programming and Scripting

changing a variable length text to a fixed length

Hi, Can anyone help with a effective solution ? I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces. The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Discussion started by: dc18
7 Replies

9. Shell Programming and Scripting

Record length

Hi, The record length may be differ in afile. I want to display the records if the record length is not equal to 50 using sed/awk command. Thanks in Advance (6 Replies)
Discussion started by: NareshN
6 Replies

10. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
IBDMCHK(1)						       IB DATA MODEL PACKAGE							IBDMCHK(1)

NAME
IBDM - Network Checker and Attributes Analyzer SYNOPSYS
ibdmchk has two operation modes: design and verification. DESIGN: ibdmchk [-v][-h][-u][-r <roots file>] -t <topology file> -n <SM Node> -p <SM Port> [-e] [-l <lmc>] VERIFICATION: ibdmchk [-v][-h][-r <roots file>] [-s <subnet file>] [-f <fdb file>] [-m <mcfdbs file> [-l <lmc>] [-u] [-M] [-a] [-c <path sl file>] [-d <sl2vl tables file>] DESIGN MODE DESCRIPTION
The Design mode is intended to be used before the cluster is built. It provides basic checks of the specified network as described by a topology file. After simulating the SM LID assignment and routing algorithms it provides reports of the (H)CA to (H)CA paths depth his- togram and credit deadlock potential in the resulting routing scheme. ARGUMENTS
: -t|--topo <topo file> The topology file specifying the network. See man ibdm-topology-file -n|--node <SM Node> The name of the Subnet Manager node (syntax: <Topo-File-System>/U1) -p|--port <SM Port> The port number by which the SM nodes is attached to the fabric. OPTIONS
-v|--verbose Verbsoe mode -h|--help Provides this help message -l|--lmc <lmc> LMC value > 0 means assigning 2^lmc lids to each port. -e|--enh Use enhanced routing algorithm when LMC > 0 and report the resulting paths correlation (using same system/node) histogram -r|--roots <roots file> A file with all the roots node names (one on each line). VERIFICATION MODE DESCRIPTION
After the cluster is built and OpenSM is run (using flag -D 0x43) it reports the subnet and FDB tables into the files osm-subnet.lst, osm.fdbs and osm.fdbs in /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /var/cache/ibutils in older OpenSM versions). ibdiagnet is also producing the same files in its output directory. Based on these files the utility checks all CA to CA connectivity. Further analysis for credit deadlock potential is performed and reported. In case of an LMC > 0 it reports histograms for how many systems and nodes are common between the different paths for the same port pairs. ARGUMENTS
-l|--lmc <lmc> The LMC value used while running OpenSM. Mandatory if not the default 0. OPTIONS
-v|--verbose Verbsoe mode -h|--help Provides this help message -s|--subnet <file> OpenSM subnet.lst file (default is /var/log/osm-subnet.lst or /var/cache/ibutils/subnet.lst) -f|--fdb <file> OpenSM dump of Ucast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.fdbs or /var/cache/ibutils/osm.fdbs). -m|--mcfdb <file> OpenSM dump of Multicast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.mcfdbs or /var/cache/ibutils/osm.mcfdbs). -c|--psl <file> Source Guid to DLID -> Path SL mapping. Each line holds: src_node_guid dlid sl. Used by the credit loop check to accuartly model SL/VL based routing. -d|--slvl <file> SL2VL mapping of all switces. Each line holds: swguid iport oport 0x(sl0)(sl1) 0x(sl2)(sl3)... Used by the credit loop check to accuartly model SL/VL based routing. -r|--roots <roots file> A file holding all root nodes guids (one per line). -u|--updn Use Up/Down based credit loop check algorithm instead of the generic one. -M|--MFT Include multicast routing in credit loops analysis. -a|--all Verify not only CA-CA paths but also SW-SW, CA-SW and SW-CA. Both check for FDB path connectivity and also for credit loops. AUTHOR
Eitan Zahavi, Mellanox Technologies LTD, eitan@mellanox.co.il IBDM 1.0 2009-03-17 IBDMCHK(1)
All times are GMT -4. The time now is 05:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy