How to handle new line if it is EOL or present as part of string?
Hi All
I am facing some issues while processing a file.
The file has \n as End Of Line. However for some records '\n' is also present as part of string. Hence I am not able to identify proper records from file.
File is # delimited.
Example:
2 rows spread across 4 lines.
When I am reading above file, I am getting 4 rows. However it should be 2 only.
Now I want to process the file so that output looks like
2 rows spread across 2 lines only
Just FYI: COL1,COL2,COL3 are generic and it can be anything. Also, I know in which column new lines may come.
If COL1, COL2,... are anything how can you determine that they make one line?
There must be some thought process you have developed to tell when a \n character is not really the end of the line. Please specify it. Like what defines a column? columns==one word?
columns are delimited by quotes?
Thanks for quick reply.
I am exporting data from RDBMS table into flat file with FIELDS TERMINATED BY '#' LINES TERMINATED BY '\n'.
However in the file there are few strings which have \n as the value. So a string ideally should be in a single line however it may spread to multiple lines with \n as value inside string.
Eg:
Now the problem is when I m reading data in HIVE, I cannot read this string completely because it encounters \n and truncates string at that point. Remaining string is treated as another line.
is there I way I can handle this situation by processing file. I don't want to export data again from RDBMS to file.
Or in other words how do we process file, when string has delimiter as the genuine value.
Hi frnds,
My requirement is I have a zip file with name say eg: test_ABC_UH_ccde2a_awdeaea_20150422.zip
within that there are subdirectories on each directory we again have .zip files and in that we have files like mama20150422.gz and so on.
Iam in need of a bash script so that it unzips... (0 Replies)
Im pretty new to shell scripting, but i have got the jist of it over the past 10 weeks or so i have been using it. I just have one thing im stuck on thats bugging the hell out of me. Here it goes...
I need a script that -
You enter a filename and then a string which reports whether that string... (2 Replies)
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Hi,
I have 80 large files, from which I want to get a specific value to run a Bash script. Firstly, I want to get the part of a file which contains this:
Name =A
xxxxxx
yyyyyy
zzzzzz
aaaaaa
bbbbbb
Value = 57
This is necessary because in a file there are written more lines which... (6 Replies)
I am attempting to grep an exact string from a series of files within a directory and append that output to the filename when it is present in the file. I've been after this all day with no luck. Thanks for your help in advance :wall:. (4 Replies)
Hi,
Can any one help how to handle the below situation.
Am using Awk script to handle variable
When I open the file in VI mode, I see the string as Orange~Rs , but when I cat the file its showing as plain Oranges.
When I copied the file over to Windows, am seeing the special character... (3 Replies)
For ddfa(7), telnetd(1M) needs to create user accounting database
records with the same line (representing the remote side) but
different ids (representing the pty that comes to be used for the
connection), like line "telnet/ss10" with first id "tb" and then
id "tf". Utmpd(1M) cannot handle... (1 Reply)
What would be the most succinct way of doing this (preferably in 1 line, maybe 2):
searching the first 10 characters of every line in a text file for a specific string, and if it was found, print out characters 11-20 of the line on which the string was found.
In this case, it's known that there... (13 Replies)
hey gurus,
my-build1-abc
my-build10-abc
my-build2-abc
my-build22-abc
my-build3-abc
basically i want to numerically sort the entire lines based on the build number. I dont zero pad the numbers because thats "how it is" ;-)
sort -n won't work because it starts from the beginning.
... (10 Replies)
Hi ,
I am doing invert grep using -v but the string contain "/" which break the grep command and it do not skip the lines with "/" on it.
Diffu.txt
========
1159c1159
< <td align="right" valign="middle" class="paddingRight2px" id="featureListItemChannelButton7466">
---
> <td... (6 Replies)