09-11-2013
It worked
Great it worked.
But somehow the top most line was not included by this command. Any reasons why.
For ex:
Topmost is Header line
Second was the body line but it remains there even if at 356 character it is "1" instead of "W"
Can you please help
![Smilie Smilie](https://www.unix.com/images/smilies/smile.gif)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file which has some lines starting with a particular word. I would like to delete 5 lines before each such line containing that particular word.
eg:
line1
line2
line3
line4
line5
line6
"particular word"...
I would like to delete line2-line6 and all such occurences in that... (4 Replies)
Discussion started by: ramu_1980
4 Replies
2. Shell Programming and Scripting
Hi There
I have this file that I would like to add entries to, however, there is a "}" as the last line that I need to keep. Basically i would like to know how I can write a script that will add new lines at the second to last line position (ie always add new line above the close bracket)
... (17 Replies)
Discussion started by: hcclnoodles
17 Replies
3. Shell Programming and Scripting
Hi,
I need to insert two new lines in a file:
The file:
".....
......
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
....
....
"
I need to add the lines:
LD_LIBRARY_PATH='$LD_LIBRARY_PATH:$APACHE_HOME/modules'
DOWNLOADMODULE_CONF_PATHNAME='$APACHE_HOME/conf/DWLModule.cfg'
right... (2 Replies)
Discussion started by: potro
2 Replies
4. UNIX for Dummies Questions & Answers
I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies
5. Shell Programming and Scripting
I want to delete all lines from a file (orig_file) that contain the regex values (bad_inv_list)
I tried a for each loop with sed but it isn't working
for file in `cat bad_inv_list`;
do
sed '/$file/d' orig_file > pared_down_file.1
mv pared_down_file.1 orig_file
done
I've added... (2 Replies)
Discussion started by: verge
2 Replies
6. Shell Programming and Scripting
Hello, I have a file like this one:
03-07-2011 sunz02 message1
03-07-2011 sunz02 message2
03-07-2011 sunz02 message3
01-07-2011 sunz02 message1
01-07-2011 sunz02 message2
01-07-2011 sunz02 ... (1 Reply)
Discussion started by: asanchez
1 Replies
7. Shell Programming and Scripting
Hello,
I have a file filled with dates, such as:
04-08-2011 message
04-08-2011 message
03-08-2011 message
01-08-2011 message
31-07-2011 message
24-07-2011 message
15-07-2011 message
13-12-2008 message
26-11-2007 message
And I want to delete those lines whose date is older than 10... (5 Replies)
Discussion started by: asanchez
5 Replies
8. Shell Programming and Scripting
Hi friends,
I have one XML file having below structure :-
INput XML file :-
<?xml version="1.0" encoding="UTF-8"?>
<START>
<A=value1>
<attr name1="a1">
</A>
<B=value2>
<attr name2="b1">
<attr name3="c1">
</B>
</START>
output xml file should be
=== (3 Replies)
Discussion started by: harpal singh
3 Replies
9. UNIX for Dummies Questions & Answers
This could be a really dummy question.
I have a log text file.
What unix command to extract line from specific string to another specific string.
Is it something similar to?:
more +/"string" file_name
Thanks (4 Replies)
Discussion started by: aku
4 Replies
10. Shell Programming and Scripting
Hello All,
Since i'm relatively new in shell script need your guidance.
I'm copying files manually based on a specific word in a file name and its extension and then moving it into some destination folder.
so if filename contains hyr word and it has .md and .db extension; it will move to TUM/HYR... (13 Replies)
Discussion started by: prajaktaraut
13 Replies
body(n) [incr Tcl] body(n)
__________________________________________________________________________________________________________________________________________________
NAME
body - change the body for a class method/proc
SYNOPSIS
itcl::body className::function args body
_________________________________________________________________
DESCRIPTION
The body command is used outside of an [incr Tcl] class definition to define or redefine the body of a class method or proc. This facility
allows a class definition to have separate "interface" and "implementation" parts. The "interface" part is a class command with declara-
tions for methods, procs, instance variables and common variables. The "implementation" part is a series of body and configbody commands.
If the "implementation" part is kept in a separate file, it can be sourced again and again as bugs are fixed, to support interactive devel-
opment. When using the "tcl" mode in the emacs editor, the "interface" and "implementation" parts can be kept in the same file; as bugs
are fixed, individual bodies can be highlighted and sent to the test application.
The name "className::function" identifies the method/proc being changed.
If an args list was specified when the function was defined in the class definition, the args list for the body command must match in mean-
ing. Variable names can change, but the argument lists must have the same required arguments and the same default values for optional
arguments. The special args argument acts as a wildcard when included in the args list in the class definition; it will match zero or more
arguments of any type when the body is redefined.
If the body string starts with "@", it is treated as the symbolic name for a C procedure. The args list has little meaning for the C pro-
cedure, except to document the expected usage. (The C procedure is not guaranteed to use arguments in this manner.) If body does not
start with "@", it is treated as a Tcl command script. When the function is invoked, command line arguments are matched against the args
list, and local variables are created to represent each argument. This is the usual behavior for a Tcl-style proc.
Symbolic names for C procedures are established by registering procedures via Itcl_RegisterC(). This is usually done in the Tcl_AppInit()
procedure, which is automatically called when the interpreter starts up. In the following example, the procedure My_FooCmd() is registered
with the symbolic name "foo". This procedure can be referenced in the body command as "@foo".
int
Tcl_AppInit(interp)
Tcl_Interp *interp; /* Interpreter for application. */
{
if (Itcl_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
if (Itcl_RegisterC(interp, "foo", My_FooCmd) != TCL_OK) {
return TCL_ERROR;
}
}
EXAMPLE
In the following example, a "File" class is defined to represent open files. The method bodies are included below the class definition via
the body command. Note that the bodies of the constructor/destructor must be included in the class definition, but they can be redefined
via the body command as well.
itcl::class File {
private variable fid ""
constructor {name access} {
set fid [open $name $access]
}
destructor {
close $fid
}
method get {}
method put {line}
method eof {}
}
itcl::body File::get {} {
return [gets $fid]
}
itcl::body File::put {line} {
puts $fid $line
}
itcl::body File::eof {} {
return [::eof $fid]
}
#
# See the File class in action:
#
File x /etc/passwd "r"
while {![x eof]} {
puts "=> [x get]"
}
itcl::delete object x
KEYWORDS
class, object, procedure
itcl 3.0 body(n)