Is anyone able to help with writing a program that will do the following:
1. Read the contents of a file, line by line, and on each line, assign each of the two columns to a shell variable.
2. perform an action on the variables
3. Read the next line.
Here is what I've gotten so far. ... (3 Replies)
The text file has one single row and looks like this
Q1 P1 2006
I have to pick up this values from a shell script into three different variables,
say quarter, period and year from the above text file. Some one know's how to do this? I went through 'sed', dint really know how to... (3 Replies)
Hi,
I have a file like the following...
CUST=
DIR=
NULIST=
name=philps_123
How can i add values to each of these unassigned variables using a shell script?
say for eg: i have values for CUST as onida, dir as /dir/onida, NULIST as /tmp/onida_files. How can i add these values to... (11 Replies)
Hi,
I have a text file with multiple lines, each having data in the below format
<DOB>,<ADDRESS>
I have to write a script which reads each line in the text file in loop, assign the values to these variables and do some further processing in it.
Using the following code prints the... (1 Reply)
Hi,
I have a text file with multiple lines, each having data in the below format <DOB>,<ADDRESS>
I have to write a script which reads each line in the text file in loop, assign the values to these variables and do some further processing in it.
Using the following code prints the values... (12 Replies)
Hi,
I have requirement to assign values to variables which are created dynamically.
Below is the code which i am using to achieve above requirement.
#!/bin/ksh
oIFS="$IFS"; IFS=','
STR_FAIL_PARENT_IF_FAILS="WF_F_P_IF_FAILS1,WF_F_P_IF_FAILS2,WF_F_P_IF_FAILS3"
set -A... (1 Reply)
For eg: I have sample.txt file with 4 rows of record like:
user1|password1
user2|password2
user3|password3
user4|password4
The username and password is sepsrated by '|'
I want to get the 1st row value from the file and assign it to two different variables(username and password)
in my... (1 Reply)
I am trying to read a input file which has two columns separated by space
Input file
server1 server2
server3 server4
server5 server6
When i execute the below while code it reads line by line and a and b variables are able to successfully fetch the values
while read a b
do
echo "$a"
echo... (5 Replies)
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
so i've been used to doing it this way:
SVAL=$(echo "7 3 2 38 3" | awk '{print $2}')
4VAL=$(echo "4:21:N:3" | awk -F":" '{print $4}')
I know there's a way to do it by putting the value in an array and assigning it that way. but i'm not sure how to do it efficiently. any ideas? i dont... (9 Replies)
Discussion started by: SkySmart
9 Replies
LEARN ABOUT X11R4
systemd-cat
SYSTEMD-CAT(1) systemd-cat SYSTEMD-CAT(1)NAME
systemd-cat - Connect a pipeline or program's output with the journal
SYNOPSIS
systemd-cat [OPTIONS...] [COMMAND] [ARGUMENTS...]
systemd-cat [OPTIONS...]
DESCRIPTION
systemd-cat may be used to connect the standard input and output of a process to the journal, or as a filter tool in a shell pipeline to
pass the output the previous pipeline element generates to the journal.
If no parameter is passed, systemd-cat will write everything it reads from standard input (stdin) to the journal.
If parameters are passed, they are executed as command line with standard output (stdout) and standard error output (stderr) connected to
the journal, so that all it writes is stored in the journal.
OPTIONS
The following options are understood:
-h, --help
Print a short help text and exit.
--version
Print a short version string and exit.
-t, --identifier=
Specify a short string that is used to identify the logging tool. If not specified, no identification string is written to the journal.
-p, --priority=
Specify the default priority level for the logged messages. Pass one of "emerg", "alert", "crit", "err", "warning", "notice", "info",
"debug", or a value between 0 and 7 (corresponding to the same named levels). These priority values are the same as defined by
syslog(3). Defaults to "info". Note that this simply controls the default, individual lines may be logged with different levels if they
are prefixed accordingly. For details, see --level-prefix= below.
--level-prefix=
Controls whether lines read are parsed for syslog priority level prefixes. If enabled (the default), a line prefixed with a priority
prefix such as "<5>" is logged at priority 5 ("notice"), and similar for the other priority levels. Takes a boolean argument.
EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise.
EXAMPLES
Example 1. Invoke a program
This calls /bin/ls with standard output and error connected to the journal:
# systemd-cat ls
Example 2. Usage in a shell pipeline
This builds a shell pipeline also invoking /bin/ls and writes the output it generates to the journal:
# ls | systemd-cat
Even though the two examples have very similar effects the first is preferable since only one process is running at a time, and both stdout
and stderr are captured while in the second example, only stdout is captured.
SEE ALSO systemd(1), systemctl(1), logger(1)systemd 237SYSTEMD-CAT(1)