lines

How to read multi-line input in a Bash script? [closed]

£可爱£侵袭症+ 提交于 2019-12-05 04:46:21
I want store in a file and in a variable multiples lines from a "paste" via shellscript. How can I acomplish that? Example: echo "Paste the certificate key:" 1fv765J85HBPbPym059qseLx2n5MH4NPKFhgtuFCeU2ep6B19chh4RY7ZmpXIvXrS7348y0NdwiYT61 1RkW75vBjGiNZH4Y9HxXfQ2VShKS70znTLxlRPfn3I7zvNZW3m3zQ1NzG62Gj1xrdPD7M2rdE2AcOr3 Pud2ij43br4K3729gbG4n19Ygx5NGI0212eHN154RuC4MtS4qmRphb2O9FJgzK8IcFW0sTn71niwLyi JOqBQmA5KtbjV34vp3lVBKCZp0PVJ4Zcy7fd5R1Fziseux4ncio32loIne1a7MPVqyIuJ8yv5IJ6s5P 485YQX0ll7hUgqepiz9ejIupjZb1003B7NboGJMga2Rllu19JC0pn4OmrnxfN025RMU6Qkv54v2fqfg

Show Indent Guide Lines In Xcode

*爱你&永不变心* 提交于 2019-12-05 04:18:26
Coming from a background using Visual Studio and Notepad++ I'm used to the indent guides which help to visually enhance sections of code where the curly braces are used, Xcode (No indent guides) Visual Studio (Nice tidy indent guides) As you can see from the images above sometimes there are sections of code where multiple levels of curly braces are open and it gets messy without any indent guides. Are there any options or plugins that will allow xcode to display the indent guides in between sections of code? Like the VS2010 sample? Xcode doesn't have this feature (not that I'm aware of) , but

How can I delete the last N lines of a file?

放肆的年华 提交于 2019-12-05 02:29:31
问题 Can someone give some hints of how to delete the last n lines from a file in Perl? I have a very large file of around 400 MB, and I want to delete some 125,000 last lines from it. 回答1: You can use Tie::File to handle the file as an array. use Tie::File; tie (@File, 'Tie::File', $Filename); splice (@File, -125000, 125000); untie @File; An alternative is to use head and wc -l in the shell. edit: grepsedawk reminds us of the -n option to head , no wc necessary: head -n -125000 FILE > NEWFILE 回答2

Objective C label line spacing?

别等时光非礼了梦想. 提交于 2019-12-05 01:34:06
问题 Is there a way to set the distance of two lines within a UILabel ? I tried to do it within Interface Builder but without success. 回答1: The code you want will be something like this: NSMutableAttributedString* attrString = [[NSMutableAttributedString alloc] initWithString:@"Sample text"]; NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; [style setLineSpacing:24]; [attrString addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, strLength)]; uiLabel

How to have line breaks in XML attributes?

拟墨画扇 提交于 2019-12-05 00:59:47
I have a attribute called: description and I want to have the following in it with new lines: This is the content description section. Download instruction: This is the contents on how to download contents. Hotline support: This is the hotline for contents. How do I create a new line for it in xml? Basically you want to insert CRLF: CR code: LF code: <myelement description="line1 line2 line3"/> If you need it in XML attribute , you'll have to use character entities: <element attribute="First line Second line Third line..." /> Try it like this: <description><![CDATA[first line<br />second

Python - Deleting the first 2 lines of a string

微笑、不失礼 提交于 2019-12-04 22:39:56
I've searched many threads here on removing the first two lines of a string but I can't seem to get it to work with every solution I've tried. Here is what my string looks like: version 1.00 6992 [-4.32063, -9.1198, -106.59][0.00064, 0.99993, -0.01210][etc...] I want to remove the first two lines of this Roblox mesh file for a script I am using. How can I do that? I don't know what your end character is, but what about something like postString = inputString.split("\n",2)[2]; The end character might need to be escaped, but that is what I would start with. x="""version 1.00 6992 [-4.32063, -9

Displaying lines from text file in a batch file

て烟熏妆下的殇ゞ 提交于 2019-12-04 21:51:33
I'm tryin' to find a script that will let me display "linenumber# and linenumber# as well as lines#-#" from a text file in a batch file? I found this script here on this site.. @echo off setlocal enabledelayedexpansion if [%1] == [] goto usage if [%2] == [] goto usage SET /a counter=0 for /f "usebackq delims=" %%a in (%2) do ( if "!counter!"=="%1" goto exit echo %%a set /a counter+=1 ) goto exit :usage echo Usage: head.bat COUNT FILENAME :exit And it works great :) But it grabs the number of lines from the top of the text file. I want to be able to display certain lines in the text file, as

get the first 3 lines of a text file in php [duplicate]

只愿长相守 提交于 2019-12-04 21:31:36
This question already has an answer here: How to read a large file line by line? 14 answers I am developing a website in PHP, and I must include in the index the first 3 lines of a text file in PHP. How can I do that? <?php $file = file_get_contents("text.txt"); //echo the first 3 lines, but it's wrong echo $file; ?> Even more simple: <?php $file_data = array_slice(file('file.txt'), 0, 3); print_r($file_data); Open the file, read lines, close the file: // Open the file for reading $file = 'file.txt'; $fh = fopen($file, 'rb'); // Handle failure if ($fh === false) { die('Could not open file: '.

How to calculate the nearest point of a line and curve? .. or curve and curve?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 17:49:53
问题 Given the points of a line and a quadratic bezier curve, how do you calculate their nearest point? 回答1: I just wanna give you a few hints, in for the case Q.B.Curve // segment : to get a fast enough computation, i think you should first think about using a kind of 'bounding box' for your algorithm. Say P0 is first point of the Q. B. Curve, P2 the second point, P1 the control point, and P3P4 the segment then : Compute distance from P0, P1, P2 to P3P4 if P0 OR P2 is nearest point --> this is

Is there a way to find the line number of the current line being read from a file?

為{幸葍}努か 提交于 2019-12-04 15:30:19
1) Is there a way in C that we could find the line number of a line that we are reading from a file. 2) I would also like to know if there is another way to find out the total number of lines in a file other than by creating a loop which looks for EOF in each line until it reaches the end. 1)Is there a way in C that we could find the line number of a line that we are reading from a file. Not unless you count the lines from the beginning of the file. You can't just position yourself arbitrarily in a file and know what line of text you're on, unless there is information in the file itself