Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Meaning of script with echo, -d, -f1, -f2 Post 302889357 by bakunin on Thursday 20th of February 2014 05:42:07 AM
Old 02-20-2014
Quote:
Originally Posted by DK2014
Is there any online link or PDF file where I can find the meaning of below,
Much better: there is a command and a database on every UNIX system: "man". If you need information about "command", enter "man command" and this should bring up a general description and all the possible options and arguments for "command", along with some example usages.

To answer your question partly:

"cut" gets some input stream and extracts a certain piece, which it outputs:

Code:
<input stream> | cut <options> | <part of the input stream cut out>

The used options and arguments tell you how the input stream is cut:

"-d<character>" means "use this character as the field delimiter". Consider the input stream:

"ab:cd:ef:gh"

"cut -d:" would now mean that ":" is used to split the stream into pieces.

"-f<number>" means to extract the field with the number after splitting the stream into pieces. Using the above stream

Code:
echo "ab:cd:ef:gh" | cut -d: -f1

would yield "ab" (the first "field"), while

Code:
echo "ab:cd:ef:gh" | cut -d: -f3

would yield "ef". Now, compare this explanation with the content of "man cut" (and all the other commands you wanted to know) and you will see that i would have to write a whole lot of text to come close to the precision of these explanations.

Some hints, though:

"[ ...]": look under "man test". Why this is so has historical reasons.

"while", "read": internal shell commands, they do not have a man page of their own. see under "man ksh" and "reserved words".

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Meaning of this line in script

Can anyone explain me the meaning of line #2 in these lines of shell script: if ; then ${EXPR} " ${MACTIONS } " : ".* ${ACTION} " >/dev/null 2>&1 || die "$USAGE" else Sorry in case this is a trivial thing (I am not an expert in this). (3 Replies)
Discussion started by: radiatejava
3 Replies

2. Shell Programming and Scripting

Using echo to create a script

Hello all, I want to be able to create a script on the fly from another script by echoing lines into a file, but am running into difficulty, as it isn't working right. What am I doing wrong? echo "for i in `grep $FRAME /root_home/powermt.sort.fil |awk '{print $7}'`" > pvtimout_set.sh... (5 Replies)
Discussion started by: LinuxRacr
5 Replies

3. UNIX for Dummies Questions & Answers

meaning of script

hello every one i want to know meaning of following line INST_PARA=$HOME/install/Install.Para SAVEMEDIUM=`awk '$2=="ArchiveSave"{print$4}' $INST_PARA` (4 Replies)
Discussion started by: kaydream
4 Replies

4. Shell Programming and Scripting

echo prints nothing-shell script

could anyone tell me why when i execute the following script, echo returns blank set k = 1 echo $k (9 Replies)
Discussion started by: saman_glorious
9 Replies

5. Shell Programming and Scripting

printf/echo in a second script

This may be little confusing. I have Script1, which pulls data from the system and creates another script(lets say script2). While I run script1 I need to add printf/echo statements for script2, so that when I run script2 I see those statement. eg: script1 765 printf " display frame-$1 timeoffset... (2 Replies)
Discussion started by: miltonrods
2 Replies

6. Shell Programming and Scripting

Whats the meaning of set -e inside the script

Hi, I would like to ask about the meaning or purpose of set -e in the script bash, Does it mean if a wrong command in the script it will close or exit the script without continuation thats what happen if i set it in the terminal. Thanks in advance (3 Replies)
Discussion started by: jao_madn
3 Replies

7. UNIX for Dummies Questions & Answers

Meaning of awk script

what does this mean? awk '!a||a>$1 {a=$1} END {for (i in a) print a,i}' file (6 Replies)
Discussion started by: osama ahmed
6 Replies

8. UNIX for Dummies Questions & Answers

UNIX Script - snipet meaning?

What would the below code snippet mean? my ($_configParam, $_paramValue) = split(/\s*=\s*/, $_, 2); $configParamHash{$_configParam} = $_paramValue; (2 Replies)
Discussion started by: MaKha
2 Replies

9. Shell Programming and Scripting

What is the meaning of ## in UNIX shell script?

Hi All, I am new to unix shell scripting and I was documenting one of the unix script and encountered below statements - for ii in `ls -1rt /oracle/admin/MARSCOPY/ext_files/fpm-ifpm/*.small.txt | tail -1 | awk '{print $1}'` do smallssim=${ii##/oracle/admin/MARSCOPY/ext_files/fpm-ifpm/}... (2 Replies)
Discussion started by: shuklajayb4
2 Replies

10. Shell Programming and Scripting

Meaning of =~ in shell script

Please let me understand the meaning of following line in unix bash scripting .is =~ means not equal to or equal to . if ]; then echo -e "pmcmd startworkflow -sv ${INTSERV} -d ${INFA_DEFAULT_DOMAIN} -uv INFA_DEFAULT_DOMAIN_USER" \ "-pv INFA_DEFAULT_DOMAIN_PASSWORD -usdv... (2 Replies)
Discussion started by: harry00514
2 Replies
SCRIPT(1)						    BSD General Commands Manual 						 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-akq] [-t time] [file [command ...]] DESCRIPTION
The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. If the argument command is given, script will run the specified command with an optional argument vector instead of an interactive shell. The following options are available: -a Append the output to file or typescript, retaining the prior contents. -k Log keys sent to program as well as output. -q Run in quiet mode, omit the start and stop status messages. -t time Specify time interval between flushing script output file. A value of 0 causes script to flush for every character I/O event. The default interval is 30 seconds. The script ends when the forked shell (or command) exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-D (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. The script utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism). HISTORY
The script command appeared in 3.0BSD. BUGS
The script utility places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. It is not possible to specify a command without also naming the script file because of argument parsing compatibility issues. When running in -k mode, echo cancelling is far from ideal. The slave terminal mode is checked for ECHO mode to check when to avoid manual echo logging. This does not work when in a raw mode where the program being run is doing manual echo. BSD
January 22, 2004 BSD
All times are GMT -4. The time now is 09:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy