How to remove new line character from query output?
Hi,
How to remove new line character from query output?
have tried select replace(column_name, CHR(10), ' ') from table_name.
Edited by: GreenHorn on Sep 11, 2008 12:53 AM
Please consider, that windows uses a sequence of chr13||chr(10) Unix uses only one character chr(10).
The new line character(s) may be OS-dependent.
You could consider both with:
replace(replace(column_name, CHR(13)||CHR(10), ' '),CHR(10),' ')
Hartmut
Edited by: hartmutm on 11.09.2008 01:32
Similar Messages
-
How to insert new line character?
Hi all,
I have two lines to print.
out.println("Available number of columns="+cols);
out.println("Number of columns must be present=10");My problem is:
i want both the lines to be printed one below the other. But, it is displayed in one single line.....
Can anyone please tell me how to insert new line character?
I tried with \n, '\n' and \r\n but, in vain......
Thanks for your time.
Regards,
AshviniYou should never use "\n" directly.
The line separator character is different on different operating systems.
And putting quotes around it in your string will make absolutely no difference in the JSP.
To find out what the line separator is you should use System.getProperty("line.separator");
The JSPWriter and PrintWriter classes will automatically use this property with a println statement, so a println will always finish with a line separator.
The issue here was that HTML by default ignores all whitespace.
The solutions provided
- use a <br> tag instead of a carriage return
- use <pre> tags, which tells the browser not to ignore whitespace. That can be troublesome in JSP which generates a lot of extraneous carriage returns into the code.
Cheers,
evnafets -
How to remove new line from string
I have a string say following
String line = "one\ntwo\nthree";Now i am trying to remove new line from string. For this i did following
String txt = line.replaceAll("\\n","");But i see still new line is occuring. Is it correct way. Please advice me.Ok. I was just using \n instead of \r\n. And i am in windows. I will give a try with \r\n
Ok i tried using following , but it doesnt work.
line = line.replaceAll("\\r\n","");Am i missing anything here. Please guide me.
Edited by: ArpanaK on Oct 8, 2007 4:44 PM -
Removing New Line Character in Input file
Hi Experts,
I Have a question about "New Line Character". I searched in SDN before posting this thread, But I didn't get answer.
Question:
Let me say my Client requirement first. After loading the data(Millions of Records) into SAP through LSMW, they asked write a program for validation of those loaded records based on I/P file. I wrote a program and It is success full.
But, the problem is when file is in Application server in 'BIN' format, a new line character(#) is created. While comparing the last record of each line, it doesn't match. How to remove this new line character(#) in I/P file for each line of record? Please see the below records for example
PROVINCIA DE BUENOS AIRE| |1870|AR| #
PROVINCIA DE BUENOS AIRE| |1876|AR| #
BOX 7407 PRINCETON| |085437407|US|NJ#
5756 2 A CAPITAL FEDERAL| |1431|AR|00#
Note: This New line character is not matching the string "#".
Please help me guys, so many objects are related with this concept. I appreciate quick response. Please.
Thanks
SaiHi Arun, Ravi,
I wrote the code like this, here 'fil_curre' is currency key.
IF <l_wa_file_data>-fil_curre CS cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF REGEX cl_abap_char_utilities=>newline
IN <l_wa_file_data>-fil_curre WITH ''.
ENDIF.
While executing the code, the cursor here, simply jumps to next step.
Any enhancements to this code or any new ideas?
Thanks
Sai -
ADF: how to insert new line character in column of VO?
Hi Everyone,
Im using Jdev 11G.
i have a VO with 5 columns displayed on the ADF page.(VO has total 8 columns)
1 column is the combination of 3 columns. i concatenated the 3 columns and added new line character after each column chr(13).
VO query is working very fine in Toad. the columnn displays each concatenated column value after a new line character but the same query is not working in ADF.
The column which is concatenating 3 columns and has to display with new line character is not displaying new line character its just concatenating the 3 values and displaying it on the page.
wat can be the solution for this in ADF?
Thank you.Setting escape="false" will allow putting html <BR> in the column and it will display ok however if your table allows export to excel the <BR> gets exported and displays as text in your exported file. Also & will export as & To prevent that, use your original text without the escape=false setting and insert LF or CR (10 or 13 character), then add inline style of white-space: pre-line; to column or to style class in your skin. That will cause all line feeds to wrap but will export to excel without mixing html in the export.
http://www.w3schools.com/cssref/pr_text_white-space.asp
Edited by: Don Kleppinger on Jan 14, 2013 4:06 PM -
Removing new line character in jdk 1.2
I am currently using replaceAll("\n", "") to remove new line characters in an string. But this works only for 1.4 version, I know need to have this work on 1.2 and 1.3.
Is there an alternate method that I can use?If the string come from a file that's in the native text format for that platform, then replaceAll(System.getProperty("line.separator", "") will work.
This won't work, however, if you, say, create a text file on windows and the read it on Unix without translating the EOL characters.
If you can't be certain that the file is in the format that matches the current platform, three options pop to mind:
* Run over the String, char by char, copying all chars to a new String except \r and \n.
* Use two replaceAll calls--one with \r and one with \n.
* Dump the String into a StringReader, then wrap the StringReader in a BufferedReader. Call readLine() on the BufferedReader in a loop, concatenating the results in a StringBuffer as you go. -
How to use new line character?
Hi,
i am getting string value like this :
name john company
test1 position director sal
45000
i am getting this value in a string.
i want to display the value like below :
name john
company test1
position director
sal 45000
how to proceed on this ? can we use new line character here ? how can we use that? pls suggest me on this.
Regards,
PavaniHi Friend,
you can use the split method of String. to split that string base on space.
for Example
String st = "Jeetendra Kumar Choudhary";
String[] string = st.split(" ");
for (int j = 0; j < string.length; j++) {
System.out.println(string[j]);
By this way you can get the each word separately and you can concatenate it again in single string.if you need it.
Regards
Jeetendra. -
Need help in how to print new line character in unix using java
Hi All,
I use the printstream class to print some line in a text using java.
here is the code:
FileOutputStream out; // declare a file output object
PrintStream p; // declare a print stream object
p.print("\t");
p.print(date);
p.print("\t\t");
p.print(RecCount);
p.println("\n");when i use this and output of this character in windows is
date RecCount
22-07-2007 23456
when i use the same code in unix it shows the following output:
date RecCount[]22-07-2007
it wont accept the new line character could any one give me an idea to solve this problem.PrintStream has a println() method. Use that. Or System.getProperty("line.separator").
Because a newline char doesn't necessarily specify a line break. It's system-dependent. -
How to write new line character to a file from textarea
Hi ,
I want to save the contents of textarea in a file.The textarea may contain new line characters,
I am getting the contents from the textarea using getText() method but after writing the contents to the file
it stores the entire text in a single line.But I want the text as it apperars in the textarea.
Please provide me a good solution.
-manimaybe this code samples are useful to your problem
File datatext = new File(fileName);
try {BufferedWriter writer =new BufferedWriter(new OutputStreamWriter(new FileOutputStream(datatext)));
writer.write(.......);
writer.newLine();
writer.close(); -
Hi,
I am reading a text file using java and sending its contents through the mail. I want to remove the space(new line) as shown below in the line 3. How can i do that in java?
Text file contents (Line numbers given for the reference)
Line1: Sales Details 1
Line2: CN P1 C1 E1 1.958
Line3:
Line4: Sales Details 2
Line5: CN P2 C2 E2 2.529
Thanks,
K. AravindhHi,
This is my code. How do you want to modify this?
List<String> members = new ArrayList<String>();
FileInputStream fstream = new FileInputStream(cube);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while ((strLine = br.readLine())!=null)
if(!(members.contains(strLine)))
members.add(strLine);
in.close();
mail.send(members);
Thanks, -
How to remove a newline character from a column
hi all...
i have a column in a table in which some of the datas contain a newline character at their last.
i need to remove those newline characters.
for example.... a data is
'abcd
(notice the end of the quotation).....i need to get the data as...'abcd'
plss help me...
thanks in advance..thanks for ur reply...
i got your point..but here what you have done is....u have inserted a particular character set in between 'abcd' and 'xyz' and afetr that just replaced those character set by null....
but in my case the problem is a bit different...
the datas are already present and what i have to do is to remove the newline spaces from the end of the datas.
select replace(column_name,'<what shall i put here>',null) from table_name;
in your example...that is 'chr(10)'...but in my case its a newline character.... -
How to add new line character \n but cant
Hi,
Im trying to add some text and seperate with a \n but its not
doing it. Ive cut down my code to the below:
<html>
<head>
<title>test</title>
</head>
<body>
<script type="text/javascript">
document.write('wer\nsd');
</script>
</body>
</html>
But it doesnt work...can anyone please help?
ThanksRudei wrote:
> Hi,
> Im trying to add some text and seperate with a \n but
its not doing it. Ive
> cut down my code to the below:
>
> <html>
> <head>
> <title>test</title>
> </head>
> <body>
> <script type="text/javascript">
> document.write('wer\nsd');
> </script>
> </body>
> </html>
>
> But it doesnt work...can anyone please help?
>
> Thanks
>
this will work:
document.write('wer'+'\n'+'sd');
and this will *probably* work:
document.write("wer\nsd");
I just replaced single quotes with double quotes
seb ( [email protected])
http://webtrans1.com | high-end web
design
Downloads: Slide Show, Directory Browser, Mailing List -
New Line Character in SQL Query
Dear All,
I am wondering if some one tell me how to insert new line character in the SQL Query Output for example I need out put in the following format. Every line on new line.
The total count is:
Registration: 1111
Fees paid: 2222
Admission Done: 3333
Total:4000
Many thanksHi
SQL> select
2 'The total count is:
3 Registration: 1111
4 Fees paid: 2222
5 Admission Done: 3333
6 Total:4000
7 ' dummy_txt from dual
8 /
DUMMY_TXT
The total count is:
Registration: 1111
Fees paid: 2222
Admission Done: 3333
Total:4000
SQL>
SQL> select 'a'||chr(10)||'b' from dual;
'A'
a
b
SQL> T -
Want to know how to check for new line character in text file
Hi All,
I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
Thanks
static int readandwriteFile(Logger logger,String filepath){
BufferedWriter out = null;
BufferedReader in = null;
File fr = null;
int get_count = 0;
try {
if(new File(filepath).exists())
fr= new File(filepath);
System.out.println("FileName: "+fr);
if(fr != null){
in = new BufferedReader(new FileReader(fr));
String text = in.readLine();
if(text != null){
get_count = Integer.parseInt(text);
in.close();
else{
get_count = 0;
else{
out = new BufferedWriter(new FileWriter(filepath));
out.write("0");
out.close();
} //Reading of the row count file ended.
catch(Exception e) {
e.printStackTrace();
finally {
try{ if (in != null) {
in.close();
if (out != null) {
out.close();
catch(Exception e) {
e.printStackTrace();
return get_count;
}You are calling the readline() only once which means you are reading only the first line from the file...
Use a loop (Do-While preferably)
do{
//your code
}while(text == "") -
How to search for a new line character in sql
hi..i am using oracle 10g.
basically i am looking for usage of columns.I want to see which all columns are used in
joins.
this is the quey i have written.
but
if there a new line between WHERE ,AND those scenarios are ignored.how to take care of these new line characters?
SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name, column_name --,line,text
FROM all_source s, cols c, all_dependencies d
WHERE s.NAME = d.NAME
AND d.referenced_name = c.table_name
AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
AND column_name ='ORGUNIT_TYPECODE_OID'
AND d.TYPE = s.TYPE
AND d.TYPE <> 'PACKAGE'
AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
AND ( (UPPER (text) LIKE
'%' || 'AND' || '%' || column_name || ' ' || '=%'
OR (UPPER (text) LIKE
'%' || 'AND' || '%=' || ' ' || '%' || column_name
|| '%'
UNION ---if there is where
SELECT DISTINCT s.TYPE, s.NAME, s.owner, table_name,
column_name ----,line,text
FROM all_source s, cols c, all_dependencies d
WHERE s.NAME = d.NAME
AND d.referenced_name = c.table_name
AND c.table_name = 'WSF_EDUCATION_ORGUNIT'
AND column_name ='ORGUNIT_TYPECODE_OID'
AND d.TYPE = s.TYPE
AND d.TYPE <> 'PACKAGE'
AND d.owner = s.owner ---FOR OVERLOADED OBJECTS
AND ( (UPPER (text) LIKE
'%' || 'WHERE' || '%' || column_name || ' ' || '=%'
OR (UPPER (text) LIKE
'%' || 'WHERE' || '%=' || ' ' || '%' || column_name
|| '%'
)Hi,
Not sure if I get it, but you can look for characters using the ascii and chr functions.
You can change them using replace:
A new line:
SQL> select ascii('
2 ') from dual;
ASCII('')
10(Just press enter between the quotes)
Example how to replace it with a space:
SQL> with t as ( -- generating test string:
2 select 'this string has
3 a new line' str from dual
4 )
5 --
6 -- actual query:
7 --
8 select str
9 , replace(str, chr(10), chr(32))
10 from t;
STR REPLACE(STR,CHR(10),CHR(32
this string has this string has a new line
a new lineIf that isn't clear of when I'm missing the point then please post some narrowes down examples of what you get now and your desired output. Remember to put the tag around any code example you're posting.
Maybe you are looking for
-
I try to open itunes but a mistake keeps apearing i tunes new library
I try to open i tunes but a mistake messages keeps apearing, " i tunes new library .
-
Better to resize JPEGs for a QT sequence before or while exporting from QT?
I have several thousand JPEG files shot as a time-lapse sequence, at my DSLR camera's smallest size of 4288 by 2848 pixels. I want to sequence them as a QuickTime movie, for a final frame size of 1920 by 1080 pixels. Is it okay to batch resize the JP
-
10G: DOWNLOAD IT NOW :)
Hi people... just download it now :) http://otn.oracle.com/software/htdocs/devlic.html?http://download.oracle.com/otn/java/jdeveloper/10g/jdev905preview.zip No "thanks" please :))))
-
Hey, Does anyone have any code on how to convert an XML file into a JTree. I also need to be able to convert a JTree into XML. Any help would be great!
-
Chart/Graph Update Mode Grayed out
I need to change the update mode for a XY Graph to Sweep Mode but the combo box for Update Mode is grayed out, any idea why?.. Thanks Solved! Go to Solution.