10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I have below requirement.
Apple
Orange
Banana
Required O/p in bash
'Apple,Orange,Banana'
Can you please help.
Please wrap your samples, codes in CODE TAGS as per forum rules. (3 Replies)
Discussion started by: Rtk
3 Replies
2. Shell Programming and Scripting
Hello All,
I have the following code in PERL to write data to excel sheet.
Can someone please help me about how to append data to an exisitng cell?
For ex in the below given case,Cell 1,1 has Active State PERL
Now I want to add a new line like "prorgamming" without overwritting the... (3 Replies)
Discussion started by: prasperl
3 Replies
3. Shell Programming and Scripting
I have a file which has lines that end with a plus (+) sign. I would like to get the next line appended to the one with the plus. For example
bla bla bla bla bla +
blip blip blip
would become
bla bla bla bla bla blip blip blip
However not all lines end with a plus sign . I would... (2 Replies)
Discussion started by: bombcan
2 Replies
4. Shell Programming and Scripting
Hi All,
I'm a newbie here, i'm having proble concatinating my 2 variables. i tried na \n but it doesn't work.
ex.
var 1="YES,AGREE"
var 2="NO,DISAGREE"
expected output is:
YES,AGREE
NO,DISAGREE
i tried this
var 3 ="${var 1} \n ${var 2}"
it outputs me YES,AGREE\nNO,DISAGREE... (2 Replies)
Discussion started by: nikki1200
2 Replies
5. Shell Programming and Scripting
Hi all,
I want to check whether tar file exists in the directory or not. If tar file exists in the directory then I want to append the files to it.
I am using the below command to tar files if the file does not exist.
tar zcvf <tar file name> <Files to append>
However, if want to... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies
6. Shell Programming and Scripting
Hi i am trying to append value with 0 to an existing file in the position 50-56 & 58-64 only where empty space is there
Rule:
1 row already has some value and i do not want to change anything for this row.
2nd record below you see the position 50-64 is empty, i want to replace with 0000000... (3 Replies)
Discussion started by: kshuser
3 Replies
7. Shell Programming and Scripting
Hi All,
I am new to Shell scripting.. I have a task to parse the text file into csv format. more then half the things has done.
But the problem is when I use the sed command in shell script. it appends newline character at the end of the line. and so when I open the file in CSV it's format... (3 Replies)
Discussion started by: Gaurang033
3 Replies
8. Shell Programming and Scripting
Hi All,
Is there any way to append a newline character at the end of a file(coma-separated file), through shell script?
I need to check whether newline character exists at the end of a file, if it does not then append it.
Regards,
Krishna (1 Reply)
Discussion started by: KrishnaSaran
1 Replies
9. UNIX for Advanced & Expert Users
Hi Guys,
the requirement is like this,
i am having a error log file in this format,
4594.493: parallel nursery GC 2594592K->2544691K (2969600K), 30.848 ms
4605.958: parallel nursery GC 2634887K->2584986K (2969600K), 38.900 ms
4619.079: parallel nursery GC 2822555K->2774812K... (12 Replies)
Discussion started by: gsprasanna
12 Replies
10. UNIX for Dummies Questions & Answers
Hi all,
Is there any way I can check a file for the linefeed character at the end of the file, and append one only if it is missing (ie. Incomplete last line)?
Need to do this because I need to write a script to process files FTP-ed over from various machines, which may or may not be... (1 Reply)
Discussion started by: ziyi
1 Replies
read(1) General Commands Manual read(1)
NAME
read - Reads a line from standard input
SYNOPSIS
read [-r] var...
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
read: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Do not treat a backslash character in any special way. Consider each backslash to be part of the input line.
Note
The -r option is included to enable read to subsume the purpose of the obsolete line utility.
OPERANDS
The name of an existing or non-existing shell variable.
DESCRIPTION
The read utility reads a single line from standard input.
By default, unless the -r option is specified, backslash () acts as an escape character. If standard input is a terminal device and the
invoking shell is interactive, read prompts for a continuation line in the following cases: The shell reads an input line ending with a
backslash, unless the -r option is specified. A here-document is not terminated after a newline character is entered.
The line is split into fields as in the shell (see the sh(1) reference page); the first field is assigned to the first variable var, the
second field to the second variable var, and so forth. If there are fewer var parameters specified than there are fields, the leftover
fields and their intervening separators are assigned to the last var. If there are fewer fields than vars, the remaining vars are set to
empty strings.
The setting of variables specified by the var parameters affects the current shell execution environment. If read is called in a subshell
or separate utility execution environment, such as one of the following, it does not affect the shell variables in the caller's environ-
ment:
(read foo) nohup read ... find . -exec read ... ;
NOTES
The -r option is included to enable read to subsume the purpose of the obsolete line utility.
RESTRICTIONS
The results are undefined if an end-of-file is detected following a backslash at the end of a line when -r is not specified.
EXIT STATUS
The following exit values are returned: Successful completion. End-of-file was detected or an error occurred.
EXAMPLES
The following command prints a file with the first field of each line moved to the end of the line:
while read -r xx yy do
printf "%s %s
" "$yy" "$xx" done < input_file
ENVIRONMENT VARIABLES
The following environment variables affect the execution of read: Determines the internal field separators used to delimit fields. Pro-
vides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value
from the default locale is used. If any of the internationalization variables contain an invalid setting, the utility behaves as if none
of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization vari-
ables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed
to multibyte characters in arguments). Determines the locale used to affect the format and contents of diagnostic messages written to
standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. Provides the prompt string that an
interactive shell will write to standard error when a line ending with a backslash is read and the -r option was not specified, or if a
here-document is not terminated after a newline character is entered.
SEE ALSO
Commands: line(1)
Functions: fread(3)
Standards: standards(5)
read(1)