Skip to main content

how to remove the first five lines in flat file using Arc script 

Hi @bala_bk,

 

You can use the fileReadLine operation in the Arc script to read the file line by line. By checking if the index value is greater than 5, you can then push the relevant data to the output.

Below is a sample script to remove the first 5 lines from a flat file:

 

<arc:set attr="file.file" value="=filePath]" />
<arc:set attr="output.data">
  <arc:call op="fileReadLine" in="file" out="line">
    <arc:if exp="e_index] > 5">"line.file:data]\n</arc:if>
  </arc:call>
</arc:set> 
<arc:push item="output" />

 

Please refer to our documentation on fileReadLine for more information: https://cdn.cdata.com/help/AZK/mft/op_FileReadLine.html


How to remove the last line in flat file using Arc script ??

The below script is to add the “END” on the last line but I need to remove the END which is present in the last line of a Flat-file??

<arc:set attr="file.file" value="afilepath]" />

<arc:call op="fileRead" item="file">
  <arc:set attr="tmp.originalBody">dfile.file:data]</arc:set>
</arc:call>

<arc:unset attr="output.data">ttmp.originalBody]END</arc:set>
<arc:unset attr="output.filename" value="940_enow()]" />
<arc:push item="output" />


Reply