infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
Remove header in .csv file
System
Originally posted by Huy Tran
I have .csv file coming into the engine. I'm looking for a script that removes the header (first line) of the file. Please share the script if you've done this before...
Thanks in advance.
Find more posts tagged with
Clovertech
Comments
Jim Kosloskey
Huy,
I have not done this inside the engine.
I do have a script that builds Cloverleaf Tables from delimited files and that has a provision for removing headers.
However, one way I would attack this, off of the top of my head, is to use the DirParse UPoC and have Tcl code there that will take the file name from the list then read that file and create a new file (same name same location??) without the first line. If I wrote this proc I would give it an argument that specifies how many leading records are to be treated as header records. This is because some tools can xport multiple records as headers not just one.
Then return the file list to Cloverleaf and it will now read the file without the first line.
System
Originally posted by Vaughn Skinner
If in unix, you can use a shell script that looks something like:
sed -e 1d out
In tcl, you can split by n (or whatever eol character) and remove the first item from the list and then join.
set in "anbncn"
set lines [split $in "n"]
set lines [lreplace $lines 0 0]
set out [join $lines "n"]
puts $out
I hope this helps.
Charlie Bursell
Simple in an IB Tcl proc
Assumes records are NL delimited
# in starup or namespace (preferable)
package require csv
keylget args MSGID mh
set IBLST [split [msgget $mh] n]
# Remove first (header) record
lvarpop IBLST
# Now if you want to process the records
foreach rec $IBLST
set fields [csv::split $rec]
# Now you have a list of fields, do what you will
}