multiline

How to echo multi lined strings in a Bourne shell [duplicate]

蓝咒 提交于 2020-01-09 10:38:43
问题 This question already has answers here : When to wrap quotes around a shell variable? (5 answers) Closed 4 years ago . I want to create some scripts for filling some templates and inserting them into my project folder. I want to use a shell script for this, and the templates are very small so I want to embed them in the shell script. The problem is that echo seems to ignore the line breaks in my string. Either that, or the string doesn't contain line breaks to begin with. Here is an example:

How to capitalize first letter of every single word in a text area?

浪子不回头ぞ 提交于 2020-01-07 08:49:15
问题 i have a multiline textfield("Adressfeld"), and i want to Uppercase every first letter and LowerCase the rest of every single word in this text area. Here is my try: function capitalize(Eingabe){ Eingabe = this.getField("Adressfeld").value; var strArr = Eingabe.split(" "); var newArr = []; for(var i = 0 ; i < strArr.length ; i++ ){ var FirstLetter = strArr[i].charAt(0).toUpperCase(); var restOfWord = strArr[i].slice(1).toLowerCAse(); newArr[i] = FirstLetter + restOfWord; } return newArr.join(

Bash How to efficiently manipulate a grep -Poz multiline output?

我是研究僧i 提交于 2020-01-05 06:50:56
问题 This is my first post on stackoverflow. \0/ I hope it's not too long of an entry. I'm writing a BASH script to regularly read, filter and output data from thousands of logfiles. Performance is important, so that's why I'm mainly using grep instead of awk or sed. grep -Poz does exactly what I want in capturing the (multiline)data using patterns that's relevant for further processing, but I'm stuck in manipulating the data to, for example, an XML-file or a SQLite3 batch-query for further

How to get user input for multiline lines in Python 3?

徘徊边缘 提交于 2020-01-05 03:50:32
问题 Total newb at this and tried to figure this out. I know that the regular input function can accept single lines, but as soon as you try to write a string paragraph and hit enter for the next line, it terminates. Is there a beginner friendly way to accept multiline user string inputs as variables? Thanks! 回答1: A common way of doing this in programs is to have an "I'm done" string (e.g. a single period), and to keep reading in lines until the line read matches that string. print("Enter as many

Logstash Multiline filter

耗尽温柔 提交于 2020-01-04 07:18:12
问题 We have some files that are written out to our web servers whenever we have php errors. Each error has it's own file, but there are always multiple lines in each file. The files always start with the text "Excepton:". Is there a way to easily just say, "take the whole file as a log event?" See example below: Exception: ABC_Exception_Domain -- Message: There is no valid performance dimension for the given nodeRootId. Error Date and Time: Date: September 25, 2014 Time: 10:38:15 Timestamp:

Trailing spaces removed on Python heredoc lines in PyCharm

孤者浪人 提交于 2020-01-03 13:58:44
问题 I'm using Python 2.7 with unittest2 within PyCharm community 3.4.1. I need to match the textual output of a CLI command with the contents of a string for an automated test. The output of this command frequently has trailing spaces at the end of lines; if I add spaces to the ends of the lines in the heredoc that I'm using to store the expected text, they mysteriously get removed in the editor and don't make it to the file. To work around this I have had to split my heredoc and recombine it

Use Tab-key on a multiline text filed in swt?

折月煮酒 提交于 2020-01-03 08:18:16
问题 How do I prevent a multi-line text field from "stealing" tab-key presses? I mean: I'd like to use TAB to cycle between the elements of a window, but when I enter the multiline text, TAB becomes a "normal" key, and simply inserts tabulators into the text I'm typing. How do I handle this? Should I write some custom listener, or can I change the behaviour of the component by using an SWT constant? 回答1: SWT defines a mechanism for implementing this kind of behaviour using the TraverseListener

Using or in multiline sed replacement

大城市里の小女人 提交于 2020-01-03 04:09:06
问题 I'm confused with a seeming simple part of sed - the or statement. I wrote the following sed which parses an event file with multiple events encapsulated between event tags and then prints the output of each event on 1 line each: machinename:~$ sed -n "/<event/,/<\/event>/ {/<result/{s/.*result value=\" \(.*\)\"\/>.*/\1/g; p}; /<sender/ {s/.*phoneNo=\"\(.*\)\" country.*/\1/g; p}}" xmlEventLog_2010-02-05T16:40:55.xml | sed '/Allowed/{N;s/\n/ /;}' Allowed +989350000100 Allowed +989350000209

Split string by delimiter

淺唱寂寞╮ 提交于 2020-01-02 01:17:04
问题 I really can't find this answer... I have multiline NSString called myString in XCode, and it is a HTML code. I need to navigate the string by lines, for example: myString = @"<html>" "<body>" "<head><title>My Page</title>"; How can I access line per line? like: LineOne = myString.Lines[0]; LineTwo = myString.Lines[1]; How can I do something like that in XCode??? I need something like the Memo component in Delphi... 回答1: The most html strings will have (mostly invisible) newline delimiters

How can I use Xcode's `Find and Replace` on Multiline blocks of text

蹲街弑〆低调 提交于 2020-01-01 17:56:51
问题 I have a large file with hundreds of blocks of text (parts of C++ method calls) that resemble the Current block below and I wish to use Xcode’s Regular Expression replacement to change each one to resemble the Desired block below, capturing values 0.89f, A name, 0.1, 0.5 and 2. Note that both blocks start and end with new Zapp and //d.p.’s to show respectively so to save myself loads of manual editing I wish to use regex search and replace. The main problem I face is the multi-line nature of