delimiter

Split String by delimiter position using oracle SQL

放肆的年华 提交于 2019-11-27 18:23:17
I have a string and I would like to split that string by delimiter at a certain position. For example, my String is F/P/O and the result I am looking for is: Therefore, I would like to separate the string by the furthest delimiter. Note: some of my strings are F/O also for which my SQL below works fine and returns desired result. The SQL I wrote is as follows: SELECT Substr('F/P/O', 1, Instr('F/P/O', '/') - 1) part1, Substr('F/P/O', Instr('F/P/O', '/') + 1) part2 FROM dual and the result is: Why is this happening and how can I fix it? You want to use regexp_substr() for this. This should work

Reading null delimited strings through a Bash loop

泪湿孤枕 提交于 2019-11-27 17:42:27
I want to iterate through a list of files without caring about what characters the filenames might contain, so I use a list delimited by null characters. The code will explain things better. # Set IFS to the null character to hopefully change the for..in # delimiter from the space character (sadly does not appear to work). IFS=$'\0' # Get null delimited list of files filelist="`find /some/path -type f -print0`" # Iterate through list of files for file in $filelist ; do # Arbitrary operations on $file here done The following code works when reading from a file, but I need to read from a

How to specify more spaces for the delimiter using cut?

雨燕双飞 提交于 2019-11-27 16:48:48
Is there any way to specify a field delimiter for more spaces with the cut command? (like " "+) ? For example: In the following string, I like to reach value '3744', what field delimiter I should say? $ps axu | grep jboss jboss 2574 0.0 0.0 3744 1092 ? S Aug17 0:00 /bin/sh /usr/java/jboss/bin/run.sh -c example.com -b 0.0.0.0 cut -d' ' is not what I want, for it's only for one single space. awk is not what I am looking for either, but how to do with 'cut'? thanks. Actually awk is exactly the tool you should be looking into: ps axu | grep '[j]boss' | awk '{print $5}' or you can ditch the grep

How do I use a dot as a delimiter?

最后都变了- 提交于 2019-11-27 08:21:12
问题 import java.util.Scanner; public class Test{ public static void main(String[] args){ Scanner input = new Scanner(System.in); input.useDelimiter("."); String given = input.next(); System.out.println(given); } } When I run the above code and type in asdf. then enter, I get nothing. It works fine with "," ";" "\"" "\\\\" or whatever, but just not with "." ... So is there something about a dot or is it just a problem with Eclipse IDE or whatever? 回答1: Scanner is using regular expression (regex)

Extracting string after last instance of delimiter in a Batch file

偶尔善良 提交于 2019-11-27 08:19:46
问题 I'm working on writing a Windows batch file that is called by a Java program. A number of different strings denoting file directories are passed into the batch file as parameters. I am trying to figure out how to extract a string after the last instance of the "\". For example, I have three directories: C:\Users\owner\Documents C:\Users\owner\Videos C:\Users\owner\Pictures\Trip I would like to split it so that the strings become: Documents Videos Trip How would you guys suggest I do this?

How to escape indicator characters (i.e. : or - ) in YAML

荒凉一梦 提交于 2019-11-27 06:28:10
In a config file, I have a key to which I wish to assign a URL. The problem is that YAML interprets : and - characters as either creating mappings or lists, so it has a problem with the line url: http://www.example-site.com/ (both because of the colon following http and the hyphen in the middle) Is there an explicit way to escape ':' and '-' ? Or would it work to just put the whole thing in single quotes and call it a day? Ry- Quotes: "url: http://www.example-site.com/" To clarify, I meant “quote the value” and originally thought the entire thing was the value. If http://www.example-site.com/

Do certain characters take more bytes than others?

吃可爱长大的小学妹 提交于 2019-11-27 06:19:17
问题 I'm not very experienced with lower level things such as howmany bytes a character is. I tried finding out if one character equals one byte, but without success. I need to set a delimiter used for socket connections between a server and clients. This delimiter has to be as small (in bytes) as possible, to minimize bandwidth. The current delimiter is "#". Would getting an other delimiter decrease my bandwidth? 回答1: It depends on what character encoding you use to translate between characters

python pandas read_csv delimiter in column data

≡放荡痞女 提交于 2019-11-27 06:07:57
问题 I'm having this type of CSV file: 12012;My Name is Mike. What is your's?;3;0 1522;In my opinion: It's cool; or at least not bad;4;0 21427;Hello. I like this feature!;5;1 I want to get this data into da pandas.DataFrame . But read_csv(sep=";") throws exceptions due to the semicolon in the user generated message column in line 2 (In my opinion: It's cool; or at least not bad). All remaining columns constantly have numeric dtypes. What is the most convenient method to manage this? 回答1: Dealing

Reading CSV files in numpy where delimiter is “,”

[亡魂溺海] 提交于 2019-11-27 06:07:16
问题 I've got a CSV file with a format that looks like this: "FieldName1", "FieldName2", "FieldName3", "FieldName4" "04/13/2010 14:45:07.008", "7.59484916392", "10", "6.552373" "04/13/2010 14:45:22.010", "6.55478493312", "9", "3.5378543" ... Note that there are double quote characters at the start and end of each line in the CSV file, and the "," string is used to delimit fields within each line. The number of fields in the CSV file can vary from file to file. When I try to read this into numpy

Can you use zero-width matching regex in String split?

此生再无相见时 提交于 2019-11-27 05:31:06
System.out.println( Arrays.deepToString( "abc<def>ghi".split("(?:<)|(?:>)") ) ); This prints [abc, def, ghi] , as if I had split on "<|>" . I want it to print [abc, <def>, ghi] . Is there a way to work some regex magic to accomplish what I want here? Perhaps a simpler example: System.out.println( Arrays.deepToString( "Hello! Oh my!! Good bye!!".split("(?:!+)") ) ); This prints [Hello, Oh my, Good bye] . I want it to print [Hello!, Oh my!!, Good bye!!] . `. You need to take a look at zero width matching constructs: (?=X) X, via zero-width positive lookahead (?!X) X, via zero-width negative