08-20-2010
Quote:
Originally Posted by
Franklin52
Do you want to store all the lines in one variable or to process the lines one by one in your shell script?
Hello,
I just want to get the value of i after processing every line.
Something like this:
vr=$i
There are seven lines in in.txt file.
So the value of i and vr would be 7.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I am trying the following to set the environment variable in my scirpt.But it is not setting with the correct value.
Can you guys please help me out to get the correct value.
1. I have environment variable NLS_LANG=American_America.UTF8
2. In my script (ksh) i am trying the following... (1 Reply)
Discussion started by: girish.raos
1 Replies
2. Shell Programming and Scripting
Dear All,
we have a command output which looks like :
Total 200 queues in 30000 Kbytes
and we're going to get "200" and "30000" for further process. currently, i'm using :
numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'
my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies
3. Shell Programming and Scripting
I have 3 files and each contain m*n matrix.
m = number of rows (horizontal lines)
n = number of columns (entries in a particular line)
What I wish to find is the sum of the 2nd number in the last row.
Ex
file1.dat
2 5 8 8
4 6 7 8
3 8 3 7
file2.dat
3 4 1 4
8 4 0 3
4 7 3 7
... (3 Replies)
Discussion started by: dynamics
3 Replies
4. Shell Programming and Scripting
Hi.
How to change string variable in awk?
for example, I parse with awk script text file named some_name_with_extension.txt
I want to print only some_name in my script
....
varCompName = FILENAME
print varCompName
How to put not all symbols from FILENAME to variable?
thank you
This... (4 Replies)
Discussion started by: cintlt
4 Replies
5. Shell Programming and Scripting
Hi all,
Hope someone can help me out here.
I have this BASH script (see below)
My problem lies with the variable path.
The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level.
The... (6 Replies)
Discussion started by: Cowardly
6 Replies
6. UNIX for Dummies Questions & Answers
Hello All,
I have csv file, where one of fields is date (yyyy/mm/dd 00:00:00). Using awk I am trying to find all records with date newer/older than specific date. My idea was to compare unix timestamps of both dates:
start=`date +%s -d "$DateStart"`
awk -v start="$start" -v current=`date +%s... (34 Replies)
Discussion started by: haczyk
34 Replies
7. Shell Programming and Scripting
I would like to replicate the functionality of chsh (or passwd -e) by awk.
This is what I got so far, but I think there should be an easier way to search and replace field $7 only for lines beginning with user_name:
awk -v user_name="$user_name" -v new_shell="$new_shell" -F: '$1 == user_name {... (2 Replies)
Discussion started by: nomad84
2 Replies
8. Shell Programming and Scripting
I am reasonably capable with awk and its quirks, but not with shell weirdness. This has to be Bourne Shell for portability reasons. I have an awk program that is working just fine; it handles multiple input streams and produces several reports, based on the request (-v Variables). In addition... (3 Replies)
Discussion started by: DerekAsirvadem
3 Replies
9. Shell Programming and Scripting
Hello,
I have text data that looks like this,
Mrv16a3102061815532D
6 6 0 0 0 0 999 V2000
-0.4018 1.9634 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.1163 1.5509 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.1163 0.7259 ... (9 Replies)
Discussion started by: LMHmedchem
9 Replies
10. UNIX for Beginners Questions & Answers
I have the following script, and I want to assign the output ($10 and $5) from awk to N and L:
grdinfo data.grd | awk '{print $10,$5}'| read N L
output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies
LEARN ABOUT XFREE86
scotty
scotty(1) Tnm Tcl Extension scotty(1)
__________________________________________________________________________________________________________________________________________________
NAME
scotty - A Tcl shell including the Tnm extensions.
SYNOPSIS
scotty ?fileName arg arg ...?
_________________________________________________________________
DESCRIPTION
scotty is a Tcl interpreter with extensions to obtain status and configuration information about TCP/IP networks. After startup, scotty
evaluates the commands stored in .scottyrc and .tclshrc in the home directory of the user.
SCRIPT FILES
If scotty is invoked with arguments then the first argument is the name of a script file and any additional arguments are made available to
the script as variables (see below). Instead of reading commands from standard input scotty will read Tcl commands from the named file;
scotty will exit when it reaches the end of the file.
If you create a Tcl script in a file whose first line is
#!/usr/local/bin/scotty2.1.11
then you can invoke the script file directly from your shell if you mark the file as executable. This assumes that scotty has been
installed in the default location in /usr/local/bin; if it's installed somewhere else then you'll have to modify the above line to match.
Many UNIX systems do not allow the #! line to exceed about 30 characters in length, so be sure that the scotty executable can be accessed
with a short file name.
An even better approach is to start your script files with the following three lines:
#!/bin/sh
# the next line restarts using scotty
exec scotty2.1.11 "$0" "$@"
This approach has three advantages over the approach in the previous paragraph. First, the location of the scotty binary doesn't have to
be hard-wired into the script: it can be anywhere in your shell search path. Second, it gets around the 30-character file name limit in
the previous approach. Third, this approach will work even if scotty is itself a shell script (this is done on some systems in order to
handle multiple architectures or operating systems: the scotty script selects one of several binaries to run). The three lines cause both
sh and scotty to process the script, but the exec is only executed by sh. sh processes the script first; it treats the second line as a
comment and executes the third line. The exec statement cause the shell to stop processing and instead to start up scotty to reprocess the
entire script. When scotty starts up, it treats all three lines as comments, since the backslash at the end of the second line causes the
third line to be treated as part of the comment on the second line.
VARIABLES
Scotty sets the following Tcl variables:
argc Contains a count of the number of arg arguments (0 if none), not including the name of the script file.
argv Contains a Tcl list whose elements are the arg arguments, in order, or an empty string if there are no arg arguments.
argv0 Contains fileName if it was specified. Otherwise, contains the name by which scotty was invoked.
tcl_interactive Contains 1 if scotty is running interactively (no fileName was specified and standard input is a terminal-like device), 0
otherwise.
PROMPTS
When scotty is invoked interactively it normally prompts for each command with ``% ''. You can change the prompt by setting the variables
tcl_prompt1 and tcl_prompt2. If variable tcl_prompt1 exists then it must consist of a Tcl script to output a prompt; instead of out-
putting a prompt scotty will evaluate the script in tcl_prompt1. The variable tcl_prompt2 is used in a similar way when a newline is typed
but the current command isn't yet complete; if tcl_prompt2 isn't set then no prompt is output for incomplete commands.
SEE ALSO
Tnm(n), Tcl(n)
AUTHORS
Juergen Schoenwaelder <schoenw@cs.utwente.nl>
Tnm scotty(1)