Whats the right name for fixed position files? - data-structures

You can structure data in various ways: for example comma separated or tab separated.
But you can also structure data on positions. So, for example, the first 20 characters are meant for a phone number, the following 2 characters are meant for the age of someone etc...
How would you call such a file in general?

If you had id[3]name[5]phone[6]
001Liz 882833
002Paul 892733
003John 927477
this is a fixed format file.

Related

Remove all letters from file names on a mac

I have about 300 photos which are a string of letters and numbers, Im planning to data merge these into an indesign document and would like to use the numbers only as these IDs are related to customers and their quotes.
I need to remove every letter or space or symbol from the file names leaving only the id number. is this possible?
Here's an example of the file names:
148132durrnt-photojosh.jpg, 173722dumellphotojosh.jpg, 173816mxwell.jpg, 176764very.jpg, 176876pyumo.jpg, 178054plnt.jpg, engll170774pijosh.jpg, entley166282pijosh.jpg, hodgkinson169226pijosh.jpg
So there's a mixture of some with the number at the start, some at the end, some in the middle, and a couple dont actually have the numbers at all so those should be ignored..
I don't know of a way to do this other than manually, and wanted to try save some time..

Feeding multiple values into a barcode leaves a '0' barcode. How do I remove this barcode entirely?

I have a system currently set up that creates a barcode for a UPC on a label. This works for single items, but sometimes I have more than one item that tries to feed into that barcode, and when that happens it is set to have no value.
However, instead of there being no barcode, there is actually a small barcode that scans in as 0. How do I ensure that no barcode appears?
^FT350,698^BY2,,75
^BCN,75,N,N,N^FD$ItemBarCode$^FS
"$ItemBarCode$" is an item from a populated table that I do not control, and there can be as many items as needed. The customer requires no barcode when there are multiple items and requires a barcode when there is one. Their sample does not use a typical UPC style barcode.
You say you don't have control over the data in the table, but do you have control over the content/format of $ItemBarCode$?
Have the variable contain the ^FD prefix and ^FS suffix (and remove from the ZPL code). When the variable is blank/empty, nothing will print.
According to the software developer consultant, the solution is to create a customization in the system's code that allows for a logic line to fix this error. This is not something that can be fixed within ZPL itself, rather, there will be two separate labels. For instance,
if single item then print X
if multiple items then print Y
I have same situation. My solution is input barcode command in single line with its data and terminator ^FD and ^FS. So during parsing label file line by line, if data is zero or error than remove entire line. And its work for me

Replace specific commas in a csv file

I have a file like this:
gene_id,transcript_id(s),length,effective_length,expected_count,TPM,FPKM,id
ENSG00000000003.14,ENST00000373020.8,ENST00000494424.1,ENST00000496771.5,ENST00000612152.4,ENST00000614008.4,2.23231E3,2.05961E3,2493,2.112E1,1.788E1,00065a62-5e18-4223-a884-12fca053a109
ENSG00000001084.10,ENST00000229416.10,ENST00000504353.1,ENST00000504525.1,ENST00000505197.1,ENST00000505294.5,ENST00000509541.5,ENST00000510837.5,ENST00000513939.5,ENST00000514004.5,ENST00000514373.2,ENST00000514933.1,ENST00000515580.1,ENST00000616923.4,3.09456E3,2.92186E3,3111,1.858E1,1.573E1,00065a62-5e18-4223-a884-12fca053a109
The problem is that instead of ,, the file should've been tab delimited because the values starting from ENST (i.e. transcript_id(s)) are grouped in one column.
The number of ENST IDs is different in each line.
Each ENST ID has the same pattern: starts from ENST, followed by 11 digits followed by a period and then 1-3 digits: ^ENST[0-9]{11}[.][0-9]{1,3}.
I want to convert all the comma's between ENST ids to a : or any other character to read this as a csv file. Any help would be much appreciated. Thanks!
I imagine something as simple as
sed 's|,ENST|:ENST|g;s|:|,|' < /path/to/your/file
should work. No reason to over-complicate.

return line of strings between two strings in a ruby variable

I would like to extract a line of strings but am having difficulties using the correct RegEx. Any help would be appreciated.
String to extract: KSEA 122053Z 21008KT 10SM FEW020 SCT250 17/08 A3044 RMK AO2 SLP313 T01720083 50005
For Some reason StackOverflow wont let me cut and paste the XML data here since it includes "<>" characters. Basically I am trying to extract data between "raw_text" ... "/raw_text" from a xml that will always be formatted like the following: http://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=3&mostRecent=true&stationString=PHNL%20KSEA
However, the Station name, in this case "KSEA" will not always be the same. It will change based on user input into a search variable.
Thanks In advance
if I can assume that every strings that you want starts with KSEA, then the answer would be:
.*(KSEA.*?)KSEA.*
using ? would let .* match as less as possible.

ADO and Microsoft Text Driver - Field Delimiter Problem

I'm using VB6 and ADO together with the Microsoft Text Driver to import data from an ASCII file. The file is comma delimited but it also contains double quotation marks around text data fields. The fields are also fixed width.
I'm having a problem that the driver reads the columns incorrectly any time one of the rows contains a quotation mark double quotation inside the content. This happens inside the "part description" column which is the second column from the left. When this occurs, columns to the right are all Null value, which is not the case in the text file.
I think it would be better to use only the commas as delimiters. However, I believe that commas also occur in the "part description" column so this means I should really load the file as fixed width. I'm not aware that there is any way of doing this unless I can specify this in the schema.ini file.
Any ideas on how to resolve this?
Edit:
You are allowed to specify fixed width in your Schema.ini file. However, it appears to me that the commas and quotation marks that also exist as delimiters/qualifiers will prevent this from working properly. It looks like I may have to "manually" read the file in and write it back out in my own format before I load it using the MS Text driver. Still looking for other opinions.
I would try changing the Format value in the registry for the Jet text engine (if that's what you're using) at the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text. I think the default is CSVDelimited but you would change this to FixedLength. See http://msdn.microsoft.com/en-us/library/ms974559.aspx
It's probably worth adding that although you have a Schema.ini file for settings, on some options the registry overrules them anyway
Actually, looking at the link I supplied, it seems you have to use a schema.ini file for fixed-length files. Have you tried something like the following, which specifies the width?
[Test.txt]
Format=FixedLength
Col1=FirstName Text Width 7
Col2=LastName Text Width 10
Col3=ID Text Integer 3
I'm extra precautious with regional settings -- some users change default list separator. Usualy fix this with schema.ini like this:
[MyFile.csv]
Format=Delimited(,)

Resources