02-23-2011
I'm afraid the environment doesn't ship with "awk".
So there is no way to do the same thing with only sed?
If not then I'll have to ask the software-maintainer to recompile a new build for our platform including awk.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
MSG="THERE WERE XX RECORDS IN ERROR TABLE,AAAA, WHEN LOADING THE BBBB TABLE WITH EXTRACT FROM CCCC INTO TABLES FOR , DATABASE DDDD."
echo "$MSG" > /tmp/mplanmsg.$$.out
I wan to replace XX with the content in $recordXX
cat /tmp/mplanmsg.$$.out|sed 's/XX/\$recordXX/g'| sed... (3 Replies)
Discussion started by: leemjesse
3 Replies
2. Shell Programming and Scripting
Hi,
I have a file which contains a word like ravi and ravi30.
i want to replace only the word ravi with xxx for that i am using the below sed command
sed -e 's/ravi/xxx/g' .
but the above command out put is xxx and xxx30 but i dont need to change ravi30
please guide me how to proceed.... (4 Replies)
Discussion started by: ravi_rn
4 Replies
3. Shell Programming and Scripting
All,
I have the following file:
--------------------------------------
#
# /etc/pam.d/common-password - password-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define the services... (2 Replies)
Discussion started by: RobertBerrie
2 Replies
4. UNIX for Dummies Questions & Answers
how do i check if the first character is a parenthese in pattern matching?
if ] obviously doesnt work. How do I use it to compare so it doesnt try to use it to group. (5 Replies)
Discussion started by: questionasker
5 Replies
5. Shell Programming and Scripting
Unfortunately this chap has been banned for some reason and I was looking forward to the resolution of his question: -
https://www.unix.com/shell-programming-scripting/123118-append-position-28-33-a.html
He was asking if you can use sed to match a pattern you want to replace within a... (6 Replies)
Discussion started by: steadyonabix
6 Replies
6. Shell Programming and Scripting
Hello All,
I have the following lines in a file
<address location="test"
ConnectionName="test" />
I want to replace the above lines by
<address location="test123" />
I am usind SED and not able to remove the new line characters between the two lines.
Can anyone please help... (4 Replies)
Discussion started by: ramk
4 Replies
7. Shell Programming and Scripting
I have a bunch of conf files, that contain the fully qualified names of servers. I would like to be able to use some sort of pattern matching with sed or vi, or whatever, to pull out the fully qualified server names, and dump them in a file.
It just needs to work across several unix os. So, I... (4 Replies)
Discussion started by: tabini
4 Replies
8. Shell Programming and Scripting
hii all
i have a file a which contains some thing like this
strand smthg position
+ yyx 3020
- yyw 10,000
now i have another file (file2) which contains the data starting from 1 to n positions
i want to refer first file if + ... (4 Replies)
Discussion started by: anurupa777
4 Replies
9. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
10. Shell Programming and Scripting
HI, I have a file:
listenerport:
- 1521
- 10520
- 10521
- 10522
- 10523
instances:
listenerport:
listenerport:
- 1521
- 10540
- 10541
- 10542
- 10543
instances:
... (5 Replies)
Discussion started by: netbanker
5 Replies
split(n) Tcl Built-In Commands split(n)
__________________________________________________________________________________________________________________________________________________
NAME
split - Split a string into a proper Tcl list
SYNOPSIS
split string ?splitChars?
_________________________________________________________________
DESCRIPTION
Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will con-
sist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if
string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty
string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space char-
acters.
EXAMPLES
Divide up a USENET group name into its hierarchical components:
split "comp.lang.tcl.announce" .
-> comp lang tcl announce
See how the split command splits on every character in splitChars, which can result in information loss if you are not careful:
split "alpha beta gamma" "temp"
-> al {ha b} {} {a ga} {} a
Extract the list words from a string that is not a well-formed list:
split "Example with {unbalanced brace character"
-> Example with {unbalanced brace character
Split a string into its constituent characters
split "Hello world" {}
-> H e l l o { } w o r l d
PARSING RECORD-ORIENTED FILES
Parse a Unix /etc/passwd file, which consists of one entry per line, with each line consisting of a colon-separated list of fields:
## Read the file
set fid [open /etc/passwd]
set content [read $fid]
close $fid
## Split into records on newlines
set records [split $content "
"]
## Iterate over the records
foreach rec $records {
## Split into fields on colons
set fields [split $rec ":"]
## Assign fields to variables and print some out...
lassign $fields
userName password uid grp longName homeDir shell
puts "$longName uses [file tail $shell] for a login shell"
}
SEE ALSO
join(n), list(n), string(n)
KEYWORDS
list, split, string
Tcl split(n)