01-19-2010
Delete new lines based on search criteria
Hi all!
A bit of background: I am trying to create a script that formats SQL statements. I have gotten so far as to add new lines based on certain match criteria like commas, keywords etc. In the process, I end up adding newlines where I don't want.
For example: substr(colName, 1, 10) becomes:
substr(colName,
1,
10) - I don't want this particular comma to be replaced with a newline.
With that in mind, my questions are:
1. Is there a way I can ignore the commas within braces - ( )
2. If not, how can I delete the newlines on lines starting with numbers, i.e. look for numbers at the beginning of a line and remove the newline before it.
In other words, if my input is:
substr(colName,
1,
10)
my output should be: substr(colName, 1, 10).
Any help is really appreciated! Thanks in advance.
Jay.
---------- Post updated 01-19-10 at 12:05 AM ---------- Previous update was 01-18-10 at 11:13 PM ----------
Another thing I forgot to mention: can I make the script intelligent enough to recognize negative numbers as well? Another example along the lines of the substr above is:
add_months(somedate, -6)
is becoming
add_months(somedate,
-6).
Don't want this to happen either.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I need to select only those records having a non zero record in the first column of a comma delimited file.
Suppose my input file is having data like:
"0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005"
"0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)
Discussion started by: shashi_kiran_v
2 Replies
2. Shell Programming and Scripting
Hi guys,
Please guide for Solution.
PART-I
INPUT FILE (has 2 columns ID and score)
TC5584_1 93.9
DV161411_2 79.5
BP132435_5 46.8
EB682112_1 34.7
BP132435_4 29.5
TC13860_2 10.1
OUTPUT FILE (It shudn't contain the line ' BP132435_4 29.5 ' as BP132435 is repeated... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies
3. Shell Programming and Scripting
I'll try explain this as best I can. Let me know if it is not clear.
I have large text files that contain data as such:
143593502 09-08-20 09:02:13 xxxxxxxxxxx xxxxxxxxxxx 09-08-20 09:02:11 N line 1 test
line 2 test
line 3 test
143593503 09-08-20 09:02:13... (3 Replies)
Discussion started by: jesse
3 Replies
4. Shell Programming and Scripting
Guys,
I manages to get awk to search and print the files that I want to delete. However I am stuck on the delete portion.
Here is the command that I am using to fins these files.
find /usr/local/apache/conf/vhosts/ -type f | awk '/e$/'
The output is perfect. The files look like so:
... (4 Replies)
Discussion started by: jaysunn
4 Replies
5. Shell Programming and Scripting
I have a huge file (about 2 millions records) contains data separated by “,” (comma). As part of the requirement, I can't change the format. The objective is to remove some of the records with the following condition. If the 23rd field on each line start with 302 , I need to remove that from the... (4 Replies)
Discussion started by: jaygamini
4 Replies
6. Shell Programming and Scripting
Hello,
Need help with following scenario.
A file contains following text:
{beginning of file}
New: This is a new record and it is not
on same line. Since I have lost touch with script
take this challenge and bring all this in one line.
New: Hello losttouch. You seem to be struggling... (4 Replies)
Discussion started by: losttouch
4 Replies
7. Shell Programming and Scripting
Hi
I need to select lines from a txt file, I have got a line starting with ZMIO:MSISDN= and after a few line I have another line starting with 'MOBILE STATION ISDN NUMBER' and another one starting with 'VLR-ADDRESS' I need to copy these three lines as three different columns in a separate... (3 Replies)
Discussion started by: Tlcm sam
3 Replies
8. Shell Programming and Scripting
Hi All,
I have following input file. I wish to retain those lines which match multiple search criteria. The search criteria is stored in a variable seperated from each other by comma(,).
SEARCH_CRITERIA = "REJECT, DUPLICATE"
Input File:
ERROR,MYFILE_20130214_11387,9,37.75... (3 Replies)
Discussion started by: angshuman
3 Replies
9. Shell Programming and Scripting
Hi Guru's,
I am new to unix scripting. I have a huge file with user details in it(file2) and I have another file with a list of users(file1). Script has to search a user from file1 and get all the associated lines from file2.
Example:
fiel1:
cn=abc
cn=DEF
cn=xyx
File 2:
dn:... (10 Replies)
Discussion started by: Samingla
10 Replies
10. Shell Programming and Scripting
Hi,
I have an input file as shown below:
20140102;13:30;FR-AUD-LIBOR-1W;2.495
20140103;13:30;FR-AUD-LIBOR-1W;2.475
20140106;13:30;FR-AUD-LIBOR-1W;2.495
20140107;13:30;FR-AUD-LIBOR-1W;2.475
20140108;13:30;FR-AUD-LIBOR-1W;2.475
20140109;13:30;FR-AUD-LIBOR-1W;2.475... (2 Replies)
Discussion started by: shash
2 Replies
LEARN ABOUT DEBIAN
poterminology
poterminology(1) Translate Toolkit 1.9.0 poterminology(1)
NAME
poterminology - reads a set of .po or .pot files to produce a pootle-terminology.pot
SYNOPSIS
poterminology [--version] [-h|--help] [--manpage] [--progress PROGRESS] [--errorlevel ERRORLEVEL] [-i|--input] INPUT [-x|--exclude EXCLUDE]
[-o|--output] OUTPUT [-u|--update UPDATEFILE] [-S|--stopword-list STOPFILE] [-F|--fold-titlecase] [-C|--preserve-case] [-I|--ignore-case]
[--accelerator ACCELERATORS] [-t|--term-words LENGTH] [--nonstop-needed MIN] [--inputs-needed MIN] [--fullmsg-needed MIN] [--substr-needed
MIN] [--locs-needed MIN] [--sort ORDER] [--source-language LANG] [-v|--invert]
DESCRIPTION
See: http://translate.sourceforge.net/wiki/toolkit/poterminology for examples and usage instructions
OPTIONS
--version
show program's version number and exit
-h/--help
show this help message and exit
--manpage
output a manpage based on the help
--progress
show progress as: dots, none, bar, names, verbose
--errorlevel
show errorlevel as: none, message, exception, traceback
-i/--input
read from INPUT in pot, po formats
-x/--exclude
exclude names matching EXCLUDE from input paths
-o/--output
write to OUTPUT in po, pot formats
-u/--update
update terminology in UPDATEFILE
-S/--stopword-list
read stopword (term exclusion) list from STOPFILE (default /usr/share/pyshared/translate/share/stoplist-en)
-F/--fold-titlecase
fold "Title Case" to lowercase (default)
-C/--preserve-case
preserve all uppercase/lowercase
-I/--ignore-case
make all terms lowercase
--accelerator
ignores the given accelerator characters when matching
-t/--term-words
generate terms of up to LENGTH words (default 3)
--nonstop-needed
omit terms with less than MIN nonstop words (default 1)
--inputs-needed
omit terms appearing in less than MIN input files (default 2, or 1 if only one input file)
--fullmsg-needed
omit full message terms appearing in less than MIN different messages (default 1)
--substr-needed
omit substring-only terms appearing in less than MIN different messages (default 2)
--locs-needed
omit terms appearing in less than MIN different original source files (default 2)
--sort output sort order(s): frequency, dictionary, length (default is all orders in the above priority)
--source-language
the source language code (default 'en')
-v/--invert
invert the source and target languages for terminology
Translate Toolkit 1.9.0 poterminology(1)