12-16-2005
How to strip the contants from a file
Hi,
I have some EDI data which 830, 862 and 997. Here is the sample data:
ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051215~184
3~U~00200~000011432~0~P~<
GS~FA~TC11A~U1CAD~051215~1843~000011432~X~002002
ST~997~0001
AK1~SH~1168
AK2~856~11680001
AK5~A
AK9~A~1~1~1
SE~6~0001
GE~1~000011432
IEA~00001~000011432
The text starts from 997. Right now the way I am extracting is look for 997 and then look for ISA and extract the text containing ISA, right before the new segment starts with the following command.
/usr/bin/gawk -v RS='ISA' '/997/ {print RS $0}' myfile.txt.
Vergsh one of the member on this forum helped me with this. Now the only problem I am facing is, it extracts the contents for other transactions too if they have 997 in the data. So I have to add one more condition to this along with the above mentioned command, that look for "ST~" right before 997 only then extract the contents otherwise ignore it.
for e.g. ST~997~0001
TIA,
Inder
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
im kind alost. i beleave its a sed command. but i cant seem to find it in my book. can someone point me in the write direction.
i know this is extreamly sloppy. but this is what i did untill i can figure out how to manipulate the filename namespace.
an ls on the directory where this would run... (2 Replies)
Discussion started by: Optimus_P
2 Replies
2. Shell Programming and Scripting
I am trying to remove or replace various extraneous characters from a file so that subsequent processes work correctly. The characters that is giving me trouble is the apostrophe '.
The command I 'm trying is
sed 's/\'//g' ${IN_WRK_DIR}/file1 > ${IN_WRK_DIR}/file2
in a Korn script on HP... (8 Replies)
Discussion started by: aquimby
8 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I am receving a file from remote site which has EDI information for 830, 862 and 997 and I want to extect the data for 997 using grep's or any other methods.
The data look like this:
ISA~000
0000-0001-1000~997
AK1000~m
000~IEA~M
ISA~000
0000-0001-1000~849
000~IEA~M
ISA~000... (11 Replies)
Discussion started by: isingh786
11 Replies
4. Shell Programming and Scripting
Hi,
How can I remove all non numerical data from line, so I don't want to delete the line but to have only the numbers.
e.g.:
#########
123
aaa124
125bbb
126
127
#########
So I want all the leading and trailing non numerical stuff(letters/white space/tabs anything else except... (10 Replies)
Discussion started by: Juha
10 Replies
5. Shell Programming and Scripting
Can an expert kindly write an efficient Linux ksh script that will strip rows with no numbers from a text file?
Supposing there are three rows that text file called text.txt :
"field1","field2","field3",11,22,33,44
"field1","field2","field3",1,2,3,4
"field1","field2","field3",,,,
The... (5 Replies)
Discussion started by: ihot
5 Replies
6. Shell Programming and Scripting
Hi
I have a file from which i need to remove the first 4 and the last 2 lines.. i know how to do it with sed but i need to do it in a perl script.. can you please help me how to do that.
Thanks (10 Replies)
Discussion started by: meghana
10 Replies
7. Shell Programming and Scripting
Hi,
I've been trying (and failing miserably) all morning to strip from a CSV file the time from it.
Can somebody point me in the right direction on how to do this using sed or awk?
The file looks like:
"James","07/20/2009-14:40:11"
"Steve","08/06/2006-02:34:37"... (5 Replies)
Discussion started by: nmuntz
5 Replies
8. Shell Programming and Scripting
please somebody tell me what is wrong with this, while the thumbnail grabbing works and encoding works, but what is not working is, mv $i.jpg /var/www/thumbs/ and mv $i.mp4 /var/www/uploads/
#!/bin/bash
# MINT 9 - FFMPEG - QT-FASTSTART - X264 - MP4
DIR=/var/www/tmp
for i in... (9 Replies)
Discussion started by: mysoogal
9 Replies
9. Shell Programming and Scripting
Hi everyone,
I hope someone can help me:
i am trying to get some info from a csv file, after i awk the column i need , i made a selection and output it in a file.
now i need to get a list from this file, but i stuck with some fields.
basically i have a text file with next data:
3... (3 Replies)
Discussion started by: lostym
3 Replies
LEARN ABOUT REDHAT
tiffdefaultstripsize
TIFFSTRIP(3T) TIFFSTRIP(3T)
NAME
TIFFDefaultStripSize, TIFFStripSize, TIFFVStripSize, TIFFComputeStrip, TIFFNumberOfStrips - strip-related utility routines
SYNOPSIS
#include <tiffio.h>
uint32 TIFFDefaultStripSize(TIFF* tif, uint32 estimate)
tsize_t TIFFStripSize(TIFF* tif)
tsize_t TIFFVStripSize(TIFF* tif, uint32 nrows)
tstrip_t TIFFComputeStrip(TIFF* tif, uint32 row, tsample_t sample)
tstrip_t TIFFNumberOfStrips(TIFF* tif)
DESCRIPTION
TIFFDefaultStripSize returns the number of rows for a reasonable-sized strip according to the current settings of the ImageWidth, BitsPer-
Sample, SamplesPerPixel, tags and any compression-specific requirements. If the estimate parameter, if non-zero, then it is taken as an
estimate of the desired strip size and adjusted according to any compression-specific requirements. The value returned by this function is
typically used to define the RowsPerStrip tag. In lieu of any unusual requirements TIFFDefaultStripSize tries to create strips that have
approximately 8 kilobytes of uncompressed data.
TIFFStripSize returns the equivalent size for a strip of data as it would be returned in a call to TIFFReadEncodedStrip or as it would be
expected in a call to TIFFWriteEncodedStrip.
TIFFVStripSize returns the number of bytes in a strip with nrows rows of data.
TIFFComputeStrip returns the strip that contains the specified coordinates. A valid strip is always returned; out-of-range coordinate val-
ues are clamped to the bounds of the image. The row parameter is always used in calculating a strip. The sample parameter is used only if
data are organized in separate planes (PlanarConfiguration=2).
TIFFNumberOfStrips returns the number of strips in the image.
DIAGNOSTICS
None.
SEE ALSO
libtiff(3T), TIFFReadEncodedStrip(3T), TIFFReadRawStrip(3T), TIFFWriteEncodedStrip(3T), TIFFWriteRawStrip(3T)
October 15, 1995 TIFFSTRIP(3T)