Sponsored Content
Full Discussion: word substitution in csh
Top Forums Shell Programming and Scripting word substitution in csh Post 83558 by vgersh99 on Thursday 15th of September 2005 11:15:18 PM
Old 09-16-2005
Code:
echo 'term1/term2/2005-12-01 13:20:30/term4' | nawk -F'[/]' -v OFS="/" '{ gsub(/[: -]/, "", $(NF-1)); print}'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command substitution problems with csh using grep

I am trying to set a command into a variable in a csh script using command substituion with ``. I am having a problem with ps command combined with grep. The command is as follows (shows processes running with the word gpts in them). /usr/ucb/ps axwww | grep gpts this works fine at the... (2 Replies)
Discussion started by: voodoo31
2 Replies

2. Shell Programming and Scripting

How to use sed substitution using a $variable for a line containing a word

$ cat ggg /E*Fare/testteam/public/pf3/nggfstatic/4k-pf3_3.case REGION1: /E*Fare/dist/src/nggfstaticbase/EFare/Server CODEBASE1: /dev_tools/LINUXMTP-4/EFS070718E/EFare/Server DATABASE1: nggfstatic SCRIPT: /efare1/admin/ezlcn/scripts/pf3_3_scriptlist.input PROLOGINITSIZE not yet set You... (4 Replies)
Discussion started by: Sangal-Arun
4 Replies

3. Linux

word substitution in unix

Hi I am trying to substitute 2 words on the same line with _S02 as suffix. Like this . IN "TSOPS09" INDEX IN "TSOPIX09" ; to IN "TSOPS09_S02" INDEX IN "TSOPIX09_S02" ; i used the following code to make the change , it works fine for first substitution not the second one . ... (6 Replies)
Discussion started by: capri_drm
6 Replies

4. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

5. Linux

Last word substitution

Ok this is last question of the day from my side . I have this file and I want to replace the last letter " , " with " ) " . The input file is #cat zip.20080604.sql CONNECT TO TST103 ; SET SESSION_USER OPSDM001 ; SET CURRENT SCHEMA OPSDM001 ; CREATE VIEW OPSDM001.vw_zip SELECT ( ... (4 Replies)
Discussion started by: capri_drm
4 Replies

6. Linux

Multiple files and word substitution

Hi , I have bunch of sql file which contain UHCDEV01 in them . I want to replace all the UHCDEV01 with UHCETL01 in all the files. I have written this code which shows correct output on sh -x but doesn't change the output file . #cat change_dbname.shl #!/bin/ksh... (1 Reply)
Discussion started by: capri_drm
1 Replies

7. Shell Programming and Scripting

whole word substitution in SED

I am trying to substitute something with sed and what I want is to substitute a whole word and not part of a word. ie sed 's/class/room/g' filename will substitute both class and classes into room and roomes which is not what i want Grep for instance can use the -w option or <> grep -w... (7 Replies)
Discussion started by: gikay01
7 Replies

8. Shell Programming and Scripting

Help with word substitution

Hi all, I am trying to write a script substituting one word in a particular file with another word (sed) but I'm having trouble creating the backup file. The following are my instructions: The Unix program sed is useful for making simple substitutions throughout an entire file. But one of... (0 Replies)
Discussion started by: Hoppy56
0 Replies

9. UNIX for Dummies Questions & Answers

Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL. I need the whole word... (6 Replies)
Discussion started by: chicchan
6 Replies

10. UNIX for Dummies Questions & Answers

Word-counting and substitution with awk

Hi!! I am trying to write a program which allows me to count how many times I used the same word in a text: {$0 = tolower ($0) gsub (/_]/, "", $0) for (i = 1; i <= NF; i++) freq++ } END { for (word in freq) printf "%s\t%d\n", word, freq It seems work but... (3 Replies)
Discussion started by: ettore8888
3 Replies
FAIL(9) 						   BSD Kernel Developer's Manual						   FAIL(9)

NAME
KFAIL_POINT_CODE, KFAIL_POINT_RETURN, KFAIL_POINT_RETURN_VOID, KFAIL_POINT_ERROR, KFAIL_POINT_GOTO, fail_point, DEBUG_FP -- fail points SYNOPSIS
#include <sys/fail.h> KFAIL_POINT_CODE(parent, name, code); KFAIL_POINT_RETURN(parent, name); KFAIL_POINT_RETURN_VOID(parent, name); KFAIL_POINT_ERROR(parent, name, error_var); KFAIL_POINT_GOTO(parent, name, error_var, label); DESCRIPTION
Fail points are used to add code points where errors may be injected in a user controlled fashion. Fail points provide a convenient wrapper around user-provided error injection code, providing a sysctl(9) MIB, and a parser for that MIB that describes how the error injection code should fire. The base fail point macro is KFAIL_POINT_CODE() where parent is a sysctl tree (frequently DEBUG_FP for kernel fail points, but various sub- systems may wish to provide their own fail point trees), and name is the name of the MIB in that tree, and code is the error injection code. The code argument does not require braces, but it is considered good style to use braces for any multi-line code arguments. Inside the code argument, the evaluation of RETURN_VALUE is derived from the return() value set in the sysctl MIB. See SYSCTL VARIABLES below. The remaining KFAIL_POINT_*() macros are wrappers around common error injection paths: KFAIL_POINT_RETURN(parent, name) is the equivalent of KFAIL_POINT_CODE(..., return RETURN_VALUE) KFAIL_POINT_RETURN_VOID(parent, name) is the equivalent of KFAIL_POINT_CODE(..., return) KFAIL_POINT_ERROR(parent, name, error_var) is the equivalent of KFAIL_POINT_CODE(..., error_var = RETURN_VALUE) KFAIL_POINT_GOTO(parent, name, error_var, label) is the equivalent of KFAIL_POINT_CODE(..., { error_var = RETURN_VALUE; goto label;}) SYSCTL VARIABLES
The KFAIL_POINT_*() macros add sysctl MIBs where specified. Many base kernel MIBs can be found in the debug.fail_point tree (referenced in code by DEBUG_FP). The sysctl variable may be set using the following grammar: <fail_point> :: <term> ( "->" <term> )* <term> :: ( (<float> "%") | (<integer> "*" ) )* <type> [ "(" <integer> ")" ] <float> :: <integer> [ "." <integer> ] | "." <integer> <type> :: "off" | "return" | "sleep" | "panic" | "break" | "print" The <type> argument specifies which action to take: off Take no action (does not trigger fail point code) return Trigger fail point code with specified argument sleep Sleep the specified number of milliseconds panic Panic break Break into the debugger, or trap if there is no debugger support print Print that the fail point executed The <float>% and <integer>* modifiers prior to <type> control when <type> is executed. The <float>% form (e.g. "1.2%") can be used to spec- ify a probability that <type> will execute. The <integer>* form (e.g. "5*") can be used to specify the number of times <type> should be exe- cuted before this <term> is disabled. Only the last probability and the last count are used if multiple are specified, i.e. "1.2%2%" is the same as "2%". When both a probability and a count are specified, the probability is evaluated before the count, i.e. "2%5*" means "2% of the time, but only 5 times total". The operator -> can be used to express cascading terms. If you specify <term1>-><term2>, it means that if <term1> does not 'execute', <term2> is evaluated. For the purpose of this operator, the return() and print() operators are the only types that cascade. A return() term only cascades if the code executes, and a print() term only cascades when passed a non-zero argument. EXAMPLES
sysctl debug.fail_point.foobar="2.1%return(5)" 21/1000ths of the time, execute code with RETURN_VALUE set to 5. sysctl debug.fail_point.foobar="2%return(5)->5%return(22)" 2/100ths of the time, execute code with RETURN_VALUE set to 5. If that does not happen, 5% of the time execute code with RETURN_VALUE set to 22. sysctl debug.fail_point.foobar="5*return(5)->0.1%return(22)" For 5 times, return 5. After that, 1/1000th of the time, return 22. sysctl debug.fail_point.foobar="0.1%5*return(5)" Return 5 for 1 in 1000 executions, but only 5 times total. sysctl debug.fail_point.foobar="1%*sleep(50)" 1/100th of the time, sleep 50ms. CAVEATS
It is easy to shoot yourself in the foot by setting fail points too aggressively or setting too many in combination. For example, forcing malloc() to fail consistently is potentially harmful to uptime. The sleep() sysctl setting may not be appropriate in all situations. Currently, fail_point_eval() does not verify whether the context is appropriate for calling msleep(). AUTHORS
This manual page was written by Zach Loafman <zml@FreeBSD.org>. BSD
May 10, 2009 BSD
All times are GMT -4. The time now is 02:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy