Ignore last lines in a file using FCC
Hello,
can we ignore last two line in a file, when we are using FCC.
in a file uploaded with some special char like $#@..... due to this mapping getting failed.
i want to ignore last two lines in a file.
Regards,
Chinna
Hi Chinna,
you can also use replaceString funtion to remove all special character and then use result for date transformation like shown below.
Hope it will be helpful for you.
Regards
Jitender
Similar Messages
-
Ignore blank lines in text file using number format exception.
hi.. does anyone know how to ignore a blank line and move on to the next line? the text file contains:
2
bla bla bla
112.4
222.5
ble ble vle
115.5
123.2The problem with trim() is that it only trims spaces (0x20). In a source code file, "blank" lines are as likely to contain TABs as spaces. I would recommend something like if (line.length() == 0 || line.matches("\\s+")) If the inefficiency of matches() becomes a problem, you can use a pre-compiled Pattern object, or roll your own isItWhitespace() method.
-
Delete a line from a file using Oracle .
Hi Gents,
Is there any option from oracle to delete the last line in a file using utl_file ?
apart from sed or other UNIX commands>
Regards
Fento.hi,
why don't you use SQL loader..?
post in this export,Import,External table forum..
Export/Import/SQL Loader & External Tables
regards,
Deepak -
Ignoring white lines in a file parsed with Scanner
I've a little problem...
How to ignore white lines in a file (for configuration informations) parsed with Scanner???
My parser can ignore #(comments) and other thing, but not white lines...
oooo
fucking little problem!!!
Thank for solutions...
euronymousWrong assumption. Scanner doesn't return lines, it returns tokens separated by delimiters which are whitespace by default, so by default it will already ignore blank lines.
If you are using custom delimiters, make sure to include space, tab, and newline (\r \n and \f) as delimiters. -
Read in the last line of a file
Can I use the "Read from File " vi to read ionly the last line of the file? If so, how? Thanks in advance for the help
[email protected]Reading the "last line" of a file implies that you are dealing with an humanly readable ASCII text file and there are special characters (/n or /r or a combination of the two) that signify line breaks.
You can only start reading from a certain byte offset using file I/O. Unless all your lines are equal lenght, It is impossible to find the start of the last line without reading every character leading up to it in one way or another.
So in the most general case, you would need to read the entire file and find the last linefeed.
HOWEVER: Typically, lines are not infinitely long, so if you have an upper estimate of line lenght, you can read a slightly longer tail from the end of the file and find the last linefeed there. You can probably modify the VI I posted here for your purpose, just use an appropriate length. Message Edited by altenbach on 06-08-2005 10:42 AM
LabVIEW Champion . Do more with less code and in less time . -
Reading Multiple lines in a file Using File Adapter
Hi All,
Iam new to this technology.How to read multiple lines in a file using file adapter.Brief me with the methodology.I didn't look at anything else but if you want to write more than one line ever to your file you should change this
out = new FileOutputStream("Calculation.log");to this...
out = new FileOutputStream("Calculation.log",true);A quick look at the API reveals the follow constructor FileOutputStream(File file, boolean append) append means should I add on the end of the file or over-write what is there.
By default you over-write. So in our case we say true instead which says add on to what is there.
At the end of that little snippet you shoudl be closing that stream as well.
So where you have
p.close();You should have
p.close();
out.close(); -
Sender File Adapter Ignore Last Line
Hi All,
Like in Sender File Adapter configuration like we have Document Offset to specify the number of starting lines to be ignored,
Like the same way can we ignore the last line of a text file .
Regards,
RahulRahul,
><i>I somehow wait for your answer,</i>
Is that a compliment
I guess there is no standard way to ignore the last line . Like you pointed out, read the line and ignore it in the mapping!
><i>btw ..
suppose in a flat file..
i just want to read the 4th line??
is there any way i can do this?</i>
Again no straight forward way to do this. You can use KeyFields etc , but there is no direct way to do this and every solution would depend on the exact requirements!
Regards
Bhavesh
PS Are the alerts issues resolved? -
How to skip first TWO Lines of .txt file using XSLT Mapping
Hi Friends ,
I have an .txt file in has the format as
<TEST>
4564564545
56456444566
56465
How can i skip the first two Lines when i am writing the XSLT Mapping ?
That <TEST> and empty line shouldn't go the rfc .
How can i skip and sent to rfc using XSLT Mapping ?
Best Regards .,
V.Rangarajanyou can avoid the empty lines in your File Content Conversion by defining offset.
<i>Under Document Offset, specify the number of lines that are to be ignored at the beginning of the document.
This enables you to skip comment lines or column names during processing. If you do not make an entry, the default value is zero lines.</i>
ref: http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
then the generated XML after FCC will not have the empty lines. -
JSP for Vcard cannot strip carriage return in the last line of the file.
I am using JSP to output a Vcard (http://en.wikipedia.org/wiki/VCard)
The following code works great in Windows but fails on the mac:
<%@ page contentType="text/x-vcard" %><%--
--%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--
--%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%--
--%>BEGIN:VCARD
VERSION:2.1
<c:choose><%--
--%><c:when test="${not ((empty param.lan) and (empty param.fin)) }"><%--
--%>N:${param.lan};${param.fin}
FN:${param.fin} ${param.lan}
</c:when><%--
--%><c:otherwise><%--
--%>FN:${param.org}
</c:otherwise><%--
--%></c:choose><%--
--%>ORG:${param.org}
TITLE:${param.title}
TEL;WORK;VOICE:${param.phwork}
ADR;WORK:;;${param.st};${param.city};${param.state};${param.zip};
EMAIL;PREF;INTERNET:${param.email}
REV:20080424T195243Z
<c:out value="${fn:replace('END:VCARD','\\\r','')}" escapeXml="false"/>After some tests, I discovered that Mac (I used Tiger, latest update, not Leopard) needs extra white space and carriage returns stripped off. Once this is achieved, the vcard will automatically import into Address Book. I have followed other forums which advice on using JSP comments as in the code above. But for some strange reason the last line of the JSP outputs an extra carraige return. How do I get rid of the carriage return at the end of the file? the replace function from JSTL is not working.
Edited by: shogo2040 on Dec 18, 2008 7:11 PM : I added more detail to the SubjectI originally had that END:VCARD without any carriage return.
But I still get an extra carriage return at the end when the JSP renders to VCF
I'm using Tomcat running on Linux.
I found this, article which implies (but does not explicitly say) JSP in general adds a newline to the last line:
http://www.caucho.com/resin-3.0/jsp/faq.xtp (But its not tomcat either, so maybe this info is irrelevant).
Edited by: shogo2040 on Dec 22, 2008 3:31 PM - changed rendered to VCF from rendered to JSP -
How to update last line in a file.
Hi
I need to append some text which should be at 2nd last line of a text file. I am getting the last line using RandomAccessFile and by ,
fileHandler.seek(fileHandler.length()-1-lastLine.length()-1);
fileHandler.writeUTF("last_line\r"+lastLine.replaceFirst("0x00", "0x80"));the above code i am trying to append the text with the updated last line. But instead of appending, the above code just replaces the last line.
How to solve this problem ?
BR
Umergimbal2 wrote:
Muhammad Umer wrote:
Hi
I need to append some text which should be at 2nd last line of a text file. I am getting the last line using RandomAccessFile and by ,
fileHandler.seek(fileHandler.length()-1-lastLine.length()-1);
fileHandler.writeUTF("last_line\r"+lastLine.replaceFirst("0x00", "0x80"));the above code i am trying to append the text with the updated last line. But instead of appending, the above code just replaces the last line.
How to solve this problem ?
BR
UmerRemember that a file, even a text file, is nothing more than a piece of administration: the administration of a collection of bytes to be exact. There are no lines, only bytes. Those bytes may represent something like a line, but that is basically only interesting during the presentation of data, the data itself has nothing to do with lines at all.
So what you are doing is seeking to a specific location on the harddrive and you are writing some bytes. Whatever was there is overwritten by the new data. You assumed that what would happen is what you see happen in a text editor, that data is inserted at the spot of the cursor, but I hope you realize that you cannot make those assumptions. Also, what you see happening is not what the text editor application is actually doing; the difference between presentation and business logic.Thank you for such a nice explanation. I have solved the problem
And for PrintWriter i will try it for understanding. Thank you. -
How to edit a line in a file using a batch file??????
Basically i want to edit one line in a properties file, using a batch file, Here is what it says
#Minecraft server properties
#Tue Feb 22 15:58:36 PST 2011
level-name=world2
hellworld=false
spawn-monsters=true
online-mode=false
spawn-animals=true
max-players=5
server-ip=5.196.238.77
pvp=true
server-port=25565
white-list=false
The IP address needs to be changed, i have a hamachi server and a server for home but i need to change this to my ip address on my computer wich is 192.168.1.74. This needs to be changed back and forth so how can i make a batch that just runs and then done its been changed.There are no .bat files in a Unix environment
#!/usr/bin/env bash
export NEW_IP=192.168.1.74
perl -ni -e '
s/d.d+.d+.d/$ENV{"NEW_IP"}/;
print;
' yourpropertiesfile
Make sure you change the file's protections so they are executable
chmod +x nameof_yourscript
There are other ways to do this, I just choose a perl script within a bash script. You could do it all with a bash script, you could use awk, you could use sed, you could use python, ruby, etc... -
Error in file to file using FCC
hey guys
i m doin File to file scenario using FCC and getting the followin error in message mapping when i load the payload from SXMB_MONI
23:43:10 Start of test
Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)
23:43:10 End of test
the payload is of the form
<?xml version="1.0" encoding="utf-8" ?>
- <ns:DT_sender xmlns:ns="http://thoughtbyte.com">
- <Recordset>
- <Row>
<Name><?xml version="1.0" encoding="utf-8" ?></Name>
</Row>
- <Row>
<Name>- <ns:DT_sender xmlns:ns="http://thoughtbyte.com"></Name>
</Row>
- <Row>
<Name>- <Recordset></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><?xml version="1.0" encoding="UTF-8"?></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><ns:MT_sender xmlns:ns="http://thoughtbyte.com"></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><Recordset></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><Row></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><Name>ewqe</Name></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><Age>das</Age></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name><Dept>fggfgf</Dept></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name></Row></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name></Recordset></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name>- <Row></Name>
</Row>
- <Row>
<Name><Name></ns:MT_sender></Name></Name>
</Row>
- <Row>
<Name></Row></Name>
</Row>
- <Row>
<Name></Recordset></Name>
</Row>
- <Row>
<Name></ns:DT_sender></Name>
</Row>
</Recordset>
</ns:DT_sender>
any idea where the error might be?
thanx
ahmadhey guys
i m still getting the same error,even though i have changed the payload
<?xml version="1.0" encoding="utf-8" ?>
<ns:DT_sender xmlns:ns="http://thoughtbyte.com">
<Recordset>
<Row>
<?xml version="1.0" encoding="UTF-8"?>
</Row>
<Row>
<ns:MT_sender xmlns:ns="http://thoughtbyte.com">
</Row>
<Row>
<Recordset>
</Row>
<Row>
<Row>
</Row>
<Row>
<Name>dsfdf</Name>
</Row>
<Row>
<Age>ghhg</Age>
</Row>
<Row>
<Dept>gfgfg</Dept>
</Row>
<Row>
</Row>
</Row>
<Row>
</Recordset>
</Row>
<Row>
</ns:MT_sender>
</Row>
</Recordset>
</ns:DT_sender>
i didnt knew why i waz getting <name></name> so i manually deleted them and also deleted the "-" and the pasted this in the file to be picked,file is pickin up but not being delivered and the error is still the same
00:27:23 Start of test
Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)
00:27:23 End of test
thanx
ahmad -
Hi Experts,
i am doing file to file scenario using fcc.in that i want to send multiple records as an xml file and i have to display that records in the receiver side.
thnaks in advance
lokeshYou can set the parameter Recordsets per message to *, otherwise also it is set to * by default.
This link is for your reference to set all the parameters in FCC.
http://help.sap.com/saphelp_nw70/helpdata/EN/0b/9a50465ccf84479e39a6d50c90fb3f/frameset.htm -
Read to get the last line from a File
Hi
I am sending in a clarification , hoping that I get an efficient solution from the group, should somebody have come across this scenario and implemented.
How to read or get the last line from a text file , which usually have a no of records, without actually reading or looping through all the lines
I know there is some solution with the RandomAccessFile, but given there can be some encoding issues or so.
Please let me know if somebody have implemented the same.
Thanks n advanceThe character encoding could, indeed, be an issue especially with UTF-8. I think what I'd do is to create a byte array with the encoded, expected end of line sequence in it and work on the file in bytes. For example, seek to the last 100 bytes of the file, read those bytes and look for an EOL sequence backwards. If not found read the previous 100, 200, 400 bytes etc. until you do find an end of line. Then seek to after the EOL and read normally. Remember an EOL sequence might cross a boundary.
UTF-8 would be a problem, especially with a unix format file because you might mistake part of a multi-byte sequence for '\n'. To be reliable on UTF-8 you'd need to go back three characters looking for sequence start markers (has the previous character got the top bit set, or the one before that the first two bits set, or the one before that the top three bits). Or you could just react to an encoding exception and try another position. -
Header and filed vlues n the same row in reciver file using FCC
Hi,
I have a scenario ,where receiver file should contain only one row (the row contain all the filed values using end separator) .
and also need to display header (file should contain only one row including header and field values).
Now i am getting 2 rows , one row contain all header ( i did using name.headerfields-3) and the second row contain all the filed values.
please let me know is there a way i can combine both header and field values in one row using receiver FCC.
Regards
Surya
Edited by: SuryaPrakash Reddy on Oct 28, 2011 9:03 AMSuryaPrakash Reddy wrote:
I thought about this (put your header in first field of your target structure.),but i want do this as last option.
this is the best option you have here since from a standard configuration you will not be able to achieve this.
Maybe you are looking for
-
How can I play avi video on my ipad 2
I have tried to play avi video on my ipad 2. It will load and show on the screen but will not play. Any ideas? Thanks.
-
Problem in PO condition update
Hi Experts, I am using 'IDOC_INPUT_PORDCR1' to post PO. Everything is working fine except the repricing. ex:- In me21 if we have 'UPDATE' button at condition item level. when I am creating i need to press UPDATE button select pricing type 'C'
-
Changing to manual sync while the ipod is NOT connected?
I was trying to find out if there was a way to change the iPods setting to sync manually (or only for selected material) without connecting the iPod to the Mac. I do not want to loose high score settings on some games. As far as I can tell I can chan
-
Best practice: managing FRA
I was not sure this was the most appropriate forum for this question; if not, please feel free to make an alternative suggestion. For those of us who run multiple databases on a box with shared disk for FRA, I am finding the extra layer of ASM and db
-
I am having constant issues with having my home network hacked. I have some neighbors that are having a one sided fight against me, not exactly sure why, but one is a network administrator and since this began they seem to be able to make my windows