02-27-2018
We've been here before...
Having <backslash><space><newline> instead of <backslash><newline> does not give you a continuation line; it gives you an escaped <space> character on one line and your unrecognized command on the next line.
This User Gave Thanks to Don Cragun For This Post:
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Some of my scripts have very long commands that go beyond the horizontal scroll limits of my screen (1024 x 768), even with a very small font. Is there a continuation character (like the option+l "ell") in AppleScript that will let me break up the line?
Right now I just press a hard return to... (2 Replies)
Discussion started by: cassj
2 Replies
2. Shell Programming and Scripting
I have written a basic fetching script. The script logs into an FTP site, downloads a .zip file, then unzips and moves the files to the necessary folders, then deletes them, etc.
The problem I have is if one of the files no longer exists on the FTP site or another part of the script fails, then... (3 Replies)
Discussion started by: daem0n
3 Replies
3. Shell Programming and Scripting
Hello. I'm trying to write a script to take a 5 field file, do some math, and extend it to 9 fields. Problem is, the script keeps wrapping it to two lines, even tho 9 fields, tab separated (even comma separated) doesn't fill the screen. Even if it did, I'm eventually copying it to an excel ... (2 Replies)
Discussion started by: JoeNess
2 Replies
4. Shell Programming and Scripting
Hello everyone...
I need to find out, how to find longest line or possibly lines in several files which are arguments for script. The thing is, that I tried some possibilities before, but nothing worked correctly.
Example
when i use:
awk ' { if ( length > L ) { L=length ;s=$0 } }END{ print... (23 Replies)
Discussion started by: 1tempus1
23 Replies
5. Shell Programming and Scripting
I am using the echo command to send the output to the file.
I am using the following code:
echo "service started successfully\n" > log
But when I do:
cat log
I get:
service started successfully\n
Instead of a newline after the "successfully"
Why is that and how can I fix it? (3 Replies)
Discussion started by: programAngel
3 Replies
6. Shell Programming and Scripting
Why does echo supress line breaks in bash?
I'm working on a script that starts like this:
words=`sort list.txt | uniq`
echo $words | wc -l
I need to number the lines and then do other stuff. I'd use jot, but it's not installed, so I hope I can get seq to do what I want. But first I need to... (2 Replies)
Discussion started by: mregine
2 Replies
7. Shell Programming and Scripting
Hi everyone,
I'm echo some text with extended ascii characters as below:
echo -e "Pr\xE9sentation du spectacle" > output
or
echo -e "Présentation du spectacle" > outputIf I open the file created I see this text
Présentation du spectacleThe text is shown correctly in this created file when... (7 Replies)
Discussion started by: Ophiuchus
7 Replies
8. Shell Programming and Scripting
I'm working on a new exercise that calls for a script that will take in two arguments on the command line (representing the range of line numbers) and will subsequently print those lines from a a specified file. Command line would look like this: ./lines_script.bash 5 15 <file.txt. The script would... (8 Replies)
Discussion started by: ksmarine1980
8 Replies
9. Shell Programming and Scripting
I can not figure out how to capture the $filename variable store by the bash.
#!/bin/bash
# oldest folder stored as variable for analysis, version log created, and quality indicators matched to run
dir=/home/cmccabe/Desktop/NGS/test
find "$dir" -maxdepth 1 -mindepth 1 -type d -printf... (5 Replies)
Discussion started by: cmccabe
5 Replies
10. Shell Programming and Scripting
I am parsing a log with this format:
06:36:12.230 details here
06:36:12.250 details here
06:36:12.260 details here
continuation here
06:36:12.360 details here
As you can see, some detail info contains one or more "\n" and it breaks my line-oriented parsing.
I need to get those... (3 Replies)
Discussion started by: migurus
3 Replies
LEARN ABOUT FREEBSD
fparseln
FPARSELN(3) BSD Library Functions Manual FPARSELN(3)
NAME
fparseln -- return the next logical line from a stream
LIBRARY
System Utilities Library (libutil, -lutil)
SYNOPSIS
#include <stdio.h>
#include <libutil.h>
char *
fparseln(FILE *stream, size_t *len, size_t *lineno, const char delim[3], int flags);
DESCRIPTION
The fparseln() function returns a pointer to the next logical line from the stream referenced by stream. This string is NUL terminated and
it is dynamically allocated on each invocation. It is the responsibility of the caller to free the pointer.
By default, if a character is escaped, both it and the preceding escape character will be present in the returned string. Various flags
alter this behaviour.
The meaning of the arguments is as follows:
stream The stream to read from.
len If not NULL, the length of the string is stored in the memory location to which it points.
lineno If not NULL, the value of the memory location to which is pointed to, is incremented by the number of lines actually read from the
file.
delim Contains the escape, continuation, and comment characters. If a character is NUL then processing for that character is disabled. If
NULL, all characters default to values specified below. The contents of delim is as follows:
delim[0] The escape character, which defaults to , is used to remove any special meaning from the next character.
delim[1] The continuation character, which defaults to , is used to indicate that the next line should be concatenated with the
current one if this character is the last character on the current line and is not escaped.
delim[2] The comment character, which defaults to #, if not escaped indicates the beginning of a comment that extends until the end
of the current line.
flags If non-zero, alter the operation of fparseln(). The various flags, which may be or-ed together, are:
FPARSELN_UNESCCOMM Remove escape preceding an escaped comment.
FPARSELN_UNESCCONT Remove escape preceding an escaped continuation.
FPARSELN_UNESCESC Remove escape preceding an escaped escape.
FPARSELN_UNESCREST Remove escape preceding any other character.
FPARSELN_UNESCALL All of the above.
RETURN VALUES
Upon successful completion a pointer to the parsed line is returned; otherwise, NULL is returned.
The fparseln() function uses internally fgetln(3), so all error conditions that apply to fgetln(3), apply to fparseln(). In addition
fparseln() may set errno to ENOMEM and return NULL if it runs out of memory.
SEE ALSO
fgetln(3)
HISTORY
The fparseln() function first appeared in NetBSD 1.4 and FreeBSD 4.0.
BSD
December 1, 1997 BSD