How to get file count in variable?

dear all,
how to get file count in variable?
regards
Naseer

Hi Nazeer ,
It wont take much time .. so simple :- )
Create one os comand step
( for unix) Use
wc -l filename.txt > someoutputfile.txt
Now the number of lines in your file will be there in the output file ( someoutputfile.txt )
Step2 :-
Now use Cezar's logic to fetch the variable value ( file count ) from the output file .. ( select value for a variable from a file )
This will not take eeven a second to finish the job.
Regards,
Rathish A M

Similar Messages

  • How to get file line count.

    Hey guys,
    How to get file line count very fast? I am using BufferedReader to readLine() and count. But when dealing with big file, say several GB size, this process will be very time consuming.
    Is there any other methods?
    Thanks in advace!

    What I'd do is you create an infofetcher, register a listener, implement gotMore() and have that scan for '\n'
    Some might suggest getting rid of the listener/sender pattern or use multiple threads to make ii faster. This might help a little, but only if your I/O is super-duper speedy.
    you are welcome to use and modify this code, but please don't change the package or take credit for it as your own work.
    InfoFetcher.java
    ============
    package tjacobs.io;
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Iterator;
    * InfoFetcher is a generic way to read data from an input stream (file, socket, etc)
    * InfoFetcher can be set up with a thread so that it reads from an input stream
    * and report to registered listeners as it gets
    * more information. This vastly simplifies the process of always re-writing
    * the same code for reading from an input stream.
    * <p>
    * I use this all over
         public class InfoFetcher implements Runnable {
              public byte[] buf;
              public InputStream in;
              public int waitTime;
              private ArrayList mListeners;
              public int got = 0;
              protected boolean mClearBufferFlag = false;
              public InfoFetcher(InputStream in, byte[] buf, int waitTime) {
                   this.buf = buf;
                   this.in = in;
                   this.waitTime = waitTime;
              public void addInputStreamListener(InputStreamListener fll) {
                   if (mListeners == null) {
                        mListeners = new ArrayList(2);
                   if (!mListeners.contains(fll)) {
                        mListeners.add(fll);
              public void removeInputStreamListener(InputStreamListener fll) {
                   if (mListeners == null) {
                        return;
                   mListeners.remove(fll);
              public byte[] readCompletely() {
                   run();
                   return buf;
              public int got() {
                   return got;
              public void run() {
                   if (waitTime > 0) {
                        TimeOut to = new TimeOut(waitTime);
                        Thread t = new Thread(to);
                        t.start();
                   int b;
                   try {
                        while ((b = in.read()) != -1) {
                             if (got + 1 > buf.length) {
                                  buf = IOUtils.expandBuf(buf);
                             int start = got;
                             buf[got++] = (byte) b;
                             int available = in.available();
                             //System.out.println("got = " + got + " available = " + available + " buf.length = " + buf.length);
                             if (got + available > buf.length) {
                                  buf = IOUtils.expandBuf(buf, Math.max(got + available, buf.length * 2));
                             got += in.read(buf, got, available);
                             signalListeners(false, start);
                             if (mClearBufferFlag) {
                                  mClearBufferFlag = false;
                                  got = 0;
                   } catch (IOException iox) {
                        throw new PartialReadException(got, buf.length);
                   } finally {
                        buf = IOUtils.trimBuf(buf, got);
                        signalListeners(true);
              private void setClearBufferFlag(boolean status) {
                   mClearBufferFlag = status;
              public void clearBuffer() {
                   setClearBufferFlag(true);
              private void signalListeners(boolean over) {
                   signalListeners (over, 0);
              private void signalListeners(boolean over, int start) {
                   if (mListeners != null) {
                        Iterator i = mListeners.iterator();
                        InputStreamEvent ev = new InputStreamEvent(got, buf, start);
                        //System.out.println("got: " + got + " buf = " + new String(buf, 0, 20));
                        while (i.hasNext()) {
                             InputStreamListener fll = (InputStreamListener) i.next();
                             if (over) {
                                  fll.gotAll(ev);
                             } else {
                                  fll.gotMore(ev);
    InputStreamListener.java
    ====================
    package tjacobs.io;
         public interface InputStreamListener {
               * the new data retrieved is in the byte array from <i>start</i> to <i>totalBytesRetrieved</i> in the buffer
              public void gotMore(InputStreamEvent ev);
               * reading has finished. The entire contents read from the stream in
               * in the buffer
              public void gotAll(InputStreamEvent ev);
    InputStreamEvent
    ===============
    package tjacobs.io;
    * The InputStreamEvent fired from the InfoFetcher
    * the new data retrieved is from <i>start</i> to <i>totalBytesRetrieved</i> in the buffer
    public class InputStreamEvent {
         public int totalBytesRetrieved;
         public int start;
         public byte buffer[];
         public InputStreamEvent (int bytes, byte buf[]) {
              this(bytes, buf, 0);
         public InputStreamEvent (int bytes, byte buf[], int start) {
              totalBytesRetrieved = bytes;
              buffer = buf;
              this.start = start;
         public int getBytesRetrieved() {
              return totalBytesRetrieved;
         public int getStart() {
              return start;
         public byte[] getBytes() {
              return buffer;
    ParialReadException
    =================
    package tjacobs.io;
    public class PartialReadException extends RuntimeException {
         public PartialReadException(int got, int total) {
              super("Got " + got + " of " + total + " bytes");
    }

  • How to get Page Count of pdf in Document library in EventHandler

    Hi,
    How to get Page Count of pdf in Document library once uploaded has been done and i would like to update the page count value in document library column of the corresponding file.
    I should achieve it in Event handler.
    Which even should i use, either ItemAdded or "ItemUpdated "?
    Thanks & Regards
    Poomani Sankaran.

    Hello,
    If you are looking for file download or view count then event handler will not work. You need to enable the analytic report to your site. Once you enable it then you can see the report within a browser or you can also create custom webpart to show count
    of specific file.
    http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx
    http://sharepoint.stackexchange.com/questions/34611/count-of-files-under-a-folder-in-a-document-library
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to get attendies count for a calendar list in sharepoint 2013?

    Hi everybody,
    I am using calendar list in SharePoint 2013 for my project.
    Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
    Because I want to display the fields like
    TOTAL SEATS =20
    Attendees= Need count
    Avail seats= total - Attendees count.
    In that way I want to show information about availability seats for training session.
    Regards,
    Dhayanand

    Hi Dhaya
    Please refer the links.Hope it helps :-)
    http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
    http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow

  • How to get file from server while click on link

    Hi,
    i created on link and i gave one server path to select file from server but while clickinng on link it no displaying any thing.
    following is the Destination url that i gave for the item.
    /u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/
    please tell me how to get file from server while click on link.

    Ok I got your requirement now.
    If you are getting file names from view attribute then you should not be adding destination URI property for the link.
    Instead you can use OADataBoundValueViewObject API.
    Try below code in your controller processRequest method:
    I am assuming that you are using classic table.
    Also in below example it considers OAMessageStyleText and you can replace it with link item if you want.
    OATableBean tableBean =
    (OATableBean)webBean.findChildRecursive("<table item id>");
    OAMessageStyledTextBean m= (OAMessageStyledTextBean)tableBean.findChildRecursive("<message styled text in table item id>");
    OADataBoundValueViewObject tip1 = new OADataBoundValueViewObject(m, "/u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/"+"<vo attr name which stores file name for each row>");
    m.setAttributeValue(oracle.cabo.ui.UIConstants.DESTINATION_ATTR, tip1);
    Regards,
    Sandeep M.

  • How to get data type of variable in program..

    Hi ABAP Guru.
    I need to know how to get data type of variable or any structure field.. because I got short dump when use command REPLACE ALL OCCURANCE ... with variable/structure field that has data type I or P, I think it should be used with data type CHAR only, So I need to check the data type first.
    Please give me your advice
    Thank you all.
    Nattapash C.

    data : v_value type i,
             v_char(10) type c.
    v_value = 10.
    move v_value to v_char.
    REPLACE ALL OCCURRENCES of '#' from v_char....
    Best regards,
    Prashant

  • Multi Mapping : How to get Message count after splitting

    Hi all,
    I am following below blog.
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    Can any body please tell me how to get the count of messages generated after splitting in the message mapping.. I have created the message data type but not aware what is needed to be done.
    Thanks and best regards,
    Kulwant Singh

    Multi mappings r done in order to split the messages to the number of messages required by the user. So for 1:N mapping, the details about "N" is based on ur requirement. So its not like - when u split, any number of message could get created. The count would be dependent on u.
    Regards,
    Prateek

  • How to get file attribs - on any Mac

    ok so if the Mac in question has Developer / Tools - yeah the GetFileInfo binary will work to get the Type and Creator code and other info.... since most Macs dont have this bulky download... how to get file attribute information via Terminal ? How to change it ?

    Oddly enough I was just now playing around with a getinfo Applescript and studying the event log when I realized that it does return information about at least some of the attributes. I made the ones that it looks like you can get information about bold:
    A Alias file
    B Bundle
    C Custom icon
    D Desktop
    E Hidden extension
    I Inited
    M Shared (can run multiple times)
    N No INIT resources
    L Locked
    S System (name locked)
    T Stationary
    V Invisible
    Z Busy
    If you are interested see this thread:
    http://discussions.apple.com/message.jspa?messageID=5261906#5261906
    The SetFile function is actually available on any Mac that has a recent Tiger updater package installed. Thus I have copies in both the package updaters and the receipts for 10.4.7, .8, .9 and .10 in the /Library/Packages and /Library/Receipts folders. The SetFile command is in the Resources folder:
    "/Library/Packages/MacOSXUpd10.4.10PPC.pkg/Contents/Resources/SetFile"
    Control click on the .pkg file and select Show contents from the Contextual Menu to get there. Unfortunately I don't know of any way to use some other Terminal command to get information on all the attributes, except the GetFileInfo and using the Applescipt get info function.
    Francine
    Francine
    Schwieder

  • How to get File type icon for files store on Amazons3

    Hi,
    i want to know about how to get file type icons for files that we store on Amazons3.i am a devloper ,i want to make gui for accessing amazons3.
    so ,i want to know about how to get file type icons for files that we store on Amazons3.
    thanx in advance.

    hi,
    have u heard amazon simple storage service,that provides storage space for
    storing files, i am a devloper,i want to know the files that we store on amazon,how we can get file type icon for that files.
    i want to sample code in java for this.
    thanx in advance.

  • How about get item count of table in formGroup.vm

    JHeadstart Team:
    I want change maxColumns=" 1" or" 2" by item count of table .but I do not know how about get item count of table .
    #if (${JHS.current.group.columns} > 10)
    #set ($majin = 2)
    #else
    #set ($majin = 1)
    #end
    <af:panelForm rows="1" maxColumns="$majin" width="${JHS.current.group.formWidth}" id="${JHS.current.group.shortName}FormItems">
    majin
    #FORM_ITEMS()
    </af:panelForm>

    You can do this using the following syntax:
    #if (${JHS.current.itemContainer.items.size()}>10)
    maxColumns="2"
    #else
    maxColumns="1"
    #end
    Steven Davelaar,
    Jheadstart Team

  • XSL-How to get value of a variable from inside loop-- to the outside loop?

    Pls help
    hi im currently working on this xsl file..
    This works on generating a txt file,my problem right now is
    ' how can i get the value of a variable generated from the inside forloop,
    i have to get the total,sum value of this variables after performing the loop
    ***this is the for loop
    <xsl:for-each select="OutboundPayment">
    <xsl:variable name='id' select='generate-id(OutboundPayment)'/>
    <xsl:sort select="PaymentNumber/CheckNumber" data-type="text" />
    <xsl:variable name='PValue' select='format-number(100*PaymentAmount/Value,"0000000000000")'/>
    <xsl:value-of select='$id'/>
    <xsl:text>D</xsl:text>
    <xsl:value-of select='$DDate'/>
    <xsl:value-of select='$Batch'/>
    <xsl:text>3</xsl:text>
    <xsl:value-of select='format-number(PaymentNumber/PaymentReferenceNumber,"0000000000")'/>
    <xsl:value-of select='format-number(PayeeBankAccount/BankAccountNumber,"0000000000")'/>
    <xsl:value-of select='substring(Payee/Name,1,20)'/>
    <xsl:value-of select='$PValue'/>
    <xsl:variable name='Addend' select='concat($DDate,substring($DAcct,5,5),$Batch)'/>
    <xsl:variable name="LHash">
    <xsl:call-template name="GetHash">
    <xsl:with-param name="A1" select="$PValue" />
    <xsl:with-param name="A2" select="$Addend" />
    </xsl:call-template>
    </xsl:variable>
    <xsl:value-of select="concat('[',$LHash,']')" />
    <!--LHash*i have to get the total amount of this one from the outside loop /---->
    <xsl:call-template name='NewLine'/>
    </xsl:for-each>
    <!--I have to put in here the total value of that LHash/---->
    <!--This is the template on how to get the value of that variable in the inside loop/---->
    <xsl:template name="GetHash">
    <xsl:param name='A1'/>
    <xsl:param name='A2'/>
    <xsl:variable name='TwoSum' select='format-number($A1+$A2,"000000000000000")'/>
    <xsl:variable name='Weight' select='317191314191112'/>
    <xsl:call-template name="WDigit">
    <xsl:with-param name="Cnt" select="15"/>
    <xsl:with-param name="Sum" select="$TwoSum"/>
    <xsl:with-param name="Wgt" select="$Weight"/>
    <xsl:with-param name="Tot" select="0"/>
    </xsl:call-template>
    </xsl:template>
    <xsl:template name='WDigit'>
    <xsl:param name='Cnt'/>
    <xsl:param name='Sum'/>
    <xsl:param name='Wgt'/>
    <xsl:param name='Tot'/>
    <xsl:choose>
    <xsl:when test="$Cnt > 0">
    <xsl:variable name='Multip' select='substring($Wgt,$Cnt,1)'/>
    <xsl:variable name='Factor' select='substring($Sum,$Cnt,1)'/>
    <xsl:variable name='Prduct' select='$Multip$Factor'/>
    <!--xsl:value-of select="concat($Tot,'[',$Cnt,']')"/-->
    <!--xsl:value-of select="concat($Multip,'x',$Factor,'=',$Prduct)"/-->
    <!--xsl:call-template name='NewLine'/-->
    <xsl:call-template name="WDigit">
    <xsl:with-param name="Cnt" select="$Cnt - 1"/>
    <xsl:with-param name="Sum" select="$Sum"/>
    <xsl:with-param name="Wgt" select="$Wgt"/>
    <xsl:with-param name="Tot" select="$Tot+$Prduct"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:variable name="Rem" select="$Tot mod 11"/>
    <xsl:variable name="Chk" select="11 - $Rem"/>
    <xsl:value-of select="format-number(concat($Tot,$Chk),'00000')"/>
    </xsl:otherwise>
    </xsl:choose>
    <xsl:template name='GetTotal'>
    </xsl:template>
    Thanks in advance for those who are willing to help.
    -Leighya

    It would have helped if you had posted your code as CODE but as it is, I could hardly read it. My guess about what you are asking is, if you want a template to return a value, just write that value to the result stream inside the template.
    If that wasn't what you were asking, then please post your code in a readable format.

  • How to get a count of unique records

    How do you get a count of unique records? Looking only for one number, not a list..so if the data is:
    ID
    ===
    1234
    1234
    1234
    1236
    1236
    1237
    Then, the count total will be one field called 'ID' with the value '3' in it..
    All I know how to do is get a count that will count all records, or do it in two queries. Looking to do this in one query statment..
    Thanks..

    Just a small clarification...
    Concatenation could potentially give wrong result, depending on the data.
    For example...
    sudhakar@ORCL>ed
    Wrote file afiedt.buf
      1  with t1 as
      2  (select 'AA' c1, '101' c2 from dual union
      3  select 'AA1' c1, '01' c2 from dual union
      4  select 'AA101' c1, null c2 from dual union
      5  select 'BB2' c1, '345' c2 from dual union
      6  select 'AA101' c1, null c2 from dual union
      7  select 'BB2' c1, '345' c2 from dual union
      8  select 'BB234' c1, '5' c2 from dual
      9  )
    10* select count(distinct c1 || c2) from t1
    sudhakar@ORCL>/
                        2IMHO, the required answer will be...
    sudhakar@ORCL>ed
    Wrote file afiedt.buf
      1  with t1 as
      2  (select 'AA' c1, '101' c2 from dual union
      3  select 'AA1' c1, '01' c2 from dual union
      4  select 'AA101' c1, null c2 from dual union
      5  select 'BB2' c1, '345' c2 from dual union
      6  select 'AA101' c1, null c2 from dual union
      7  select 'BB2' c1, '345' c2 from dual union
      8  select 'BB234' c1, '5' c2 from dual
      9  )
    10* select count(distinct c1 ||'.'|| c2) from t1
    sudhakar@ORCL>/
                             5
    sudhakar@ORCL>vr,
    Sudhakar B.

  • How to get File name in Proxy program

    Hi,
    According to my business scenario, one XML file name comes from Legacy system and stores in a predefined directory. Now XI has to pick up that XML file and needs to call BAPI's which in turn updates the Target system ( SAP Tables).
    Now my problem is , XML File name is a combination of three fileds those are DATE , OBJECTKEY AND WORKFLOWNAME.
    Ex : YYYYMMDD_1234565789_WORKFLOWNAME.XML
         DATE_OBJECTKEY_WORKFLOWNAME.XML
    In proxy i need to get the file name and split into three fields ( those are DATE , OBJECTKEY AND WORKFLOWNAME ) which needs to send as import parameters in BAPI's.
    So please let me know from anyone in this group how to get the file name in the proxy program.
    Thanks & Regards
    K. naveen Kumar

    Hi,
    have a look at my new weblog:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    to see how you can access filename
    Regards,
    michal

  • How to get the count of repeating elements in a xml doc.

    In many xml documents, in is common to have repeating child elements and what I would like to know is how do I determine exactly how many of these child elements exist in a particular document. There is probably a correct XPath string to determine this, but I cannot figure out what it is. Here is an example
    <a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>
    The above 'c' element is what varies in number from document to document and I need to know how to get the number of 'c' elements for the document, which would be 3 in the above case.

    create table test_xml(data xmltype)
    insert into test_xml values(
    xmltype('<a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>')
    select extract(data, '/a/b/c').getclobval() from test_xml
    select count(*) from test_xml
    where existsnode(data, '/a/b/c')=1
    good luck.

  • How to get file name of the form attachment?

    Hi,
    is there anybody who is able to help me with the following problem???
    I started my process from Workspace ES and as a first step I attached one locale file (IMG.JPG or IMG.TIF e.g.) as a form attachment. I used "Attachments" bookmark in the Workspace ES.
    I need to get file name of attached file in the process!!!
    I tried to use "getTaskAttachments" component to get file name of form attachment but without success. This component successfully obtained attached file an stored it in the variable (type list, subtype document) but didn't produce all file attribute informations such as basename or Content Type:
    Is there some possibility to obtain file name (including file extension) by using "standard" tools and components of ALC?
    Thanks for your suggestions.

    Hi LekomDev,
    I faced the same situation some time back and this is what I know.
    Based on the file type few of the attributes will or will not be populated. (This is what the official documentation says about Document attributes)
    The file name that you are looking for would mostly be in 'name' attribute of Document object. The 'wsfilename' attribute is the atrribute which gets used to show the file name into Attachments tab of the workspace.
    So, if you are just interested in knowing the filenames then 'name' attribute is the place that you are looking for.
    But if you are trying to solve an issue in which Attachments against a Task isn't showing the filenames properly then you would need to copy the 'name' attribute value into 'wsfilename' attribute and then the Attachmetns against a Task would have the correct names.
    Tip: Use the Record and Playback option of the workbench to inspect the Document variable and you would see all of the values for a Document variable at desired step in your orchestration.
    hope this helps,
    cheers,
    Parth Pandya
    Blog: http://livecyclekarma.wordpress.com

Maybe you are looking for

  • Problem with nokia N81

    Hello  I have a nokia N81 and i recently installed whatsapp. While configuring it I was asked to enter the Username I entered my name on hitting the continue button the application closed automatically. Its annoying and I an unable to use the applica

  • Alter system set shared_pool_size extremely slow.

    I am trying to increase my shared_pool_size from 60m to 200m by simply typing alter system set shared_pool_size=200m; I did alter system flush shared_pool; before to clear out the current shared_pool. I'm on 9i and my SGA_MAX_SIZE is 3g and I have pl

  • Editing adobe form output in ECC screen

    Hi all, I am creating adobe form in ECC. Then I can change its output in portal page. But I can not change the output in ECC screen. can you help me about this issue? Thank you for your interest,

  • PDF is not right showed

    Hi, I have some E-tickets of the Dutch 'See-tickets' I just received 3 E-tickets in PDF Format. Only, the first E-ticket is half blanc. The other tickets are complete, with 'lokatie, datum, aanvang' etc filled in. When I open the same file, on a wind

  • Packaging with missing fonts

    I have (what I consider to be) a complex issue with missing fonts when packaging a project for print. I'm fairly new at using ID. It's a little complicated, so I'll attempt to be as precise as possible. When I package my files, a warning comes up in