02-03-2004
One possibility:
sed 's/\[[A-Z]*\]/\[replacement-string\]/g'
But this is ksh and you don't say what you're using. Feel free to
search the forums as well ... there's plenty of examples and different ways to do this.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
One of the senior administrators gave me a shell script to modify and it begins as follows:
if ] && ]
{more code follows}
Why the double square brackets? (10 Replies)
Discussion started by: mojoman
10 Replies
2. Shell Programming and Scripting
Hi
First apologies if this has been raised before.
I've got the following in a ksh script:
if ]
For some reason this does not work. But if I remove the double square brackets to:
if
This works.
I thought ksh supported the ]. Or is there more to it?
Thanks in advance. (3 Replies)
Discussion started by: tsu3000
3 Replies
3. Shell Programming and Scripting
Hi,
I just came across an interesting shell script syntax like the one below:
] && (trap 'rm -rf ${WORK_DIR}/*.$$; echo "\n\nInterrupted !!\n\n"; exit 4' 1 2 3 15)
Can someone please explain the code snippet above?
The trap command bit is fine but ] && is the hazy part.
Generally we use an... (2 Replies)
Discussion started by: King Nothing
2 Replies
4. UNIX for Dummies Questions & Answers
Hello,
Can someone please explain to me the following line,
] && break
I do not understand why two test square brackets are used.
Thanks,
Shantanu
---------- Post updated at 03:38 PM ---------- Previous update was at 03:35 PM ----------
And, also why there's a $ before (echo $c |... (5 Replies)
Discussion started by: Shan_u2005
5 Replies
5. Shell Programming and Scripting
hi guys,
i'm writing a script that looks for a unquie id in a file and replaces a string between two square brackets on the same line as the unquie id:
.......
.......
0001 zz 43242 replace this text] name
0002 sd 65466 UK] country
.......
.......
how can i find line with id 0001... (6 Replies)
Discussion started by: zaff
6 Replies
6. Shell Programming and Scripting
Hi All,
I have a text file which looks like this:
computer programming
systems engineering
I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this:
computer programming
systems engineering
I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies
7. Shell Programming and Scripting
I wanted to compare the value inside the Squre bracket after Colon ( : ) based on any value(seperated by or operator | ) inside the variable Thread and if match found then wnated to store in output file
Input file :
20140320 00:08:43.918 INO 35] - Corporate hub is
20140320 00:08:43.918... (2 Replies)
Discussion started by: nes
2 Replies
8. Shell Programming and Scripting
I wanted to store the number inside the square bracket between colon( : ) and closing suqre bracket(]) in some variable.
Suppose I have lines like :
Input file :
20140320 00:08:23.846 INFO 84] - anything in line
20140320 00:08:23.846 Test 589] - Virtual and lab lab anything... (18 Replies)
Discussion started by: nes
18 Replies
9. Shell Programming and Scripting
Hello all,
I have the following problem:
$ cat infile
this is spam and i need this too
this is spam and i need this too
$ perl -nwe '$_ =~ /]+ \]+)\]\]*\]? (\+)$/; print "$1 - $2\n";' infile
i need this - too
i need this - and i need this too
I am not sure how many occurences of... (13 Replies)
Discussion started by: zaxxon
13 Replies
10. Shell Programming and Scripting
Hi All,
Hope you all are doing good. Yesterday in my project i came across a scenario which i can not guess why it was working in one region and why it was not in another region. Please find my issue below.
I am using AIX version 6.0 of UNIX in my project, in shell scripting i have the... (1 Reply)
Discussion started by: mad man
1 Replies
LEARN ABOUT DEBIAN
aephea-ref
aephea-ref(7) MISCELLANEOUS aephea-ref(7)
NAME
aephea-ref - A description of the Aephea definitions for referencing
DESCRIPTION
The following definitions are used by the Aephea simpledocument class as well as the Portable Unix Documentation (pud) manual and faq
classes (see pud-man(7) and pud-faq(7)).
MACROS
efload#2
efloadx#2
Both macros take as first argument a label that uniquely defines the reference. The second argument is a vararg containing key-value
pairs.
These macros are usually not needed in Aephea classes; they are lower level facilities.
ef#2
The first argument is a label. The second argument should be a key associated with that label. The result is the value associated with the
label/key pair.
These macros are usually not needed in Aephea classes; they are lower level facilities used by high level Aephea definitions (e.g.
iref#2, and secref#1).
efcaption#1
efnumber#1
eflevel#1
The argument is a label. The result is respectively the caption, number, or level associated with that label.
eference#1
efer#1
The first associates a number with the label that is in the first argument, and prints it inbeween square brackets. The label is anchored
to this location. The second outputs the associated number inbetween brackets, and makes it carry a link to the anchor. For example, I am
about to create a link [1] and another link [2] to the items appearing below.
[1] The first reference.
[2] The second reference.
If you prefer another bibliography style, find the macros and adapt them according to your needs - they are very simple.
eference#2 currently writes data to the file \__fnbase__.zmr, to be read back in using a load{\__fnbase__.zmr} statement. This is
automatically done when using any of the Aephea classes.
aephea-ref 1.002, 10-008 8 Jan 2010 aephea-ref(7)