Sponsored Content
Top Forums Shell Programming and Scripting How to strip '$' sign on the line Post 302509446 by zam on Wednesday 30th of March 2011 09:11:01 PM
Old 03-30-2011
Thanks for the prompt reply. Though I need to use ksh commands. (sorry for omitting that)
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sign on/Sign off logging script

I'd like to make a script that I can execute every time I sign on to my linux box that keeps track of the time and allows to me to add a remark to a file. So basically once I log in, I run the script, and it outputs the date and time to a text file (log.txt). But that isn't my problem. I need... (1 Reply)
Discussion started by: Glider
1 Replies

2. Shell Programming and Scripting

Need to strip a string

I have a file that looks like this: /home/fred/opt/bin /opt/usr/bin /usr/sbin/var/opt I need a way to chop of everything after the last occurance of the / sign including the /. So the file above will now look like this below. /home/fred/opt /opt/usr /usr/sbin/var I tried using... (6 Replies)
Discussion started by: x96riley3
6 Replies

3. Shell Programming and Scripting

how do i strip this line using perl regex.

I have a variable dynamically generated $batch = /dataload/R3P/interface/Bowne/reports/RDI00244.rpt Now I'd like to strip '/dataload/R3P/interface/Bowne/reports/RDI' and '.rpt' from this variable my output should be only 00244 how to do this using perl regex.I'm a newbie to perl and would... (1 Reply)
Discussion started by: ramky79
1 Replies

4. Shell Programming and Scripting

Strip one line from 2 blank lines in a file

Hi Is there any command to scan thru a file looking for 2 consecutive blank lines and if any remove one of them. Please let me know. Regards, Tipsy (6 Replies)
Discussion started by: tipsy
6 Replies

5. Shell Programming and Scripting

strip carriage return & append next line

Hello everyone, I am trying to search a file for lines that start with 'ip:' and have a carriage return after(ip:$). I then want to remove the carriage return from that line and append the next line in the file to the line containing 'ip'. I tried doing this with SED, but had no luck. Any... (3 Replies)
Discussion started by: vada010
3 Replies

6. HP-UX

Typing the @ sign creates new line.

Whenever I type the @ sign like for example when using a proxy ftp server, The system forces the cursor to jump to a new line. I know it has something to do with the terminal settings. How can I get this to stop and more importantly, how can I modify my profile to set this up whenever I login? ... (3 Replies)
Discussion started by: ricnetman
3 Replies

7. Shell Programming and Scripting

Bash command line to strip tar.gz file extension?

What's the command syntax for stripping out the tar.gz file extension in a bash command line (not script file). Thanks! prompt/> ls *.tar.gz | <what comes here?> (3 Replies)
Discussion started by: ZillaG
3 Replies

8. Shell Programming and Scripting

Moving line up if line starts with + sign.

Hello everyone, I'm struggling with this command: awk '!/^\+/{ORS=FS}/^\+/{ORS=RS}1' file1 > file2 What I want to do is to move any line that starts with the + sign 1 up, so its the continuation of the previous. The above command is messing the whole output, can you please let me know... (8 Replies)
Discussion started by: demmel
8 Replies

9. Shell Programming and Scripting

sed - How to replace right part of equal sign (=) on a line

Hello. Using a bash script , I have a variable name for the file I want to modify FILE_TO_EDIT="/etc/my_config_file"And I have a variable name for the parameter to change PARAMETER="fallback_node" PARAMETER_NEW_VALUE="http://my_server_name.com/new_path" A config file may contain : 1°)... (2 Replies)
Discussion started by: jcdole
2 Replies
apply(n)						       Tcl Built-In Commands							  apply(n)

__________________________________________________________________________________________________________________________________________________

NAME
apply - Apply an anonymous function SYNOPSIS
apply func ?arg1 arg2 ...? _________________________________________________________________ DESCRIPTION
The command apply applies the function func to the arguments arg1 arg2 ... and returns the result. The function func is a two element list {args body} or a three element list {args body namespace} (as if the list command had been used). The first element args specifies the formal arguments to func. The specification of the formal arguments args is shared with the proc com- mand, and is described in detail in the corresponding manual page. The contents of body are executed by the Tcl interpreter after the local variables corresponding to the formal arguments are given the val- ues of the actual parameters arg1 arg2 .... When body is being executed, variable names normally refer to local variables, which are cre- ated automatically when referenced and deleted when apply returns. One local variable is automatically created for each of the function's arguments. Global variables can only be accessed by invoking the global command or the upvar command. Namespace variables can only be accessed by invoking the variable command or the upvar command. The invocation of apply adds a call frame to Tcl's evaluation stack (the stack of frames accessed via uplevel). The execution of body pro- ceeds in this call frame, in the namespace given by namespace or in the global namespace if none was specified. If given, namespace is interpreted relative to the global namespace even if its name does not start with "::". The semantics of apply can also be described by: proc apply {fun args} { set len [llength $fun] if {($len < 2) || ($len > 3)} { error "can't interpret "$fun" as anonymous function" } lassign $fun argList body ns set name ::$ns::[getGloballyUniqueName] set body0 { rename [lindex [info level 0] 0] {} } proc $name $argList ${body0}$body set code [catch {uplevel 1 $name $args} res opt] return -options $opt $res } EXAMPLES
This shows how to make a simple general command that applies a transformation to each element of a list. proc map {lambda list} { set result {} foreach item $list { lappend result [apply $lambda $item] } return $result } map {x {return [string length $x]:$x}} {a bb ccc dddd} -> 1:a 2:bb 3:ccc 4:dddd map {x {expr {$x**2 + 3*$x - 2}}} {-4 -3 -2 -1 0 1 2 3 4} -> 2 -2 -4 -4 -2 2 8 16 26 The apply command is also useful for defining callbacks for use in the trace command: set vbl "123abc" trace add variable vbl write {apply {{v1 v2 op} { upvar 1 $v1 v puts "updated variable to "$v"" }}} set vbl 123 set vbl abc SEE ALSO
proc(n), uplevel(n) KEYWORDS
argument, procedure, anonymous function Tcl apply(n)
All times are GMT -4. The time now is 10:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy