Search Results

Search: Posts Made By: arindam guha
1,263
Posted By anbu23
awk ' { sub("^[^#]","#&") } 1 ' ...
awk ' { sub("^[^#]","#&") } 1 ' file
1,263
Posted By radoulov
A slightly different version: sed...
A slightly different version:

sed 's/^[^#]/#&/' infilePrefix every line that starts with a character different than # with #.
1,263
Posted By bakunin
sed '/^#/ ! s/^/#/' /path/to/input This...
sed '/^#/ ! s/^/#/' /path/to/input

This s/^/#/ puts a "#" in front of a line. This: /^#/ ! makes sure this operation is only carried out on lines not starting with "#".

I hope this helps.
...
1,345
Posted By drl
Hi. Non-standard utility msort allows you to...
Hi.

Non-standard utility msort allows you to specify fields from the right as well as the left:
#!/usr/bin/env bash

# @(#) s1 Demonstrate specify field from right end, msort.
# See:...
1,345
Posted By Yoda
sort -t'_' -k3n file
sort -t'_' -k3n file
3,100
Posted By Scott
Perhaps you should use double quotes rather than...
Perhaps you should use double quotes rather than single quotes. The shell won't evaluate $c or $d if they're encased in single quotes.
3,100
Posted By Scott
You can do this using 'command substitution': ...
You can do this using 'command substitution':

someVar=$(echo $value1 | sed 's/[()@.+/]/\\&/g')
3,100
Posted By alister
To modify a stream: sed 's/[()@.]/\\&/g' ...
To modify a stream: sed 's/[()@.]/\\&/g'

Regards,
Alister
1,910
Posted By MadeInGermany
I am afraid you need to \ escape each special...
I am afraid you need to \ escape each special character:
In the search pattern, ( and ) and . are special in perl RE, and need to be escaped \( and \) and \.
In both the search pattern and the...
11,391
Posted By Yoda
I think I got the problem. In your original XML...
I think I got the problem. In your original XML file, the tags are all in one single line. This is the reason why the code is not working.

I didn't copy your original XML, but instead I actually...
11,391
Posted By Yoda
This is what I get when I run on 2 files ...
This is what I get when I run on 2 files

Source XML
$ cat source.xml
<tns:property>
<tns:name>AdminOutQueue</tns:name>
<tns:type>String</tns:type>
<tns:subtype>QueueName</tns:subtype>
...
11,391
Posted By Yoda
You could code something like this: awk ' ...
You could code something like this:
awk '
BEGIN {
F = "source.xml"
while ((getline line < F) > 0)
{
if ( line ~...
11,391
Posted By Yoda
An awk solution: printf "Enter TNS name: " ...
An awk solution:
printf "Enter TNS name: "
read tnsname

awk -F'[<>]' -v T="$tnsname" '
$0 ~ T && $0 ~ /tns:name/ {
f = 1
}
...
11,391
Posted By DGPickett
One approach is to make tuple lines, where the...
One approach is to make tuple lines, where the name and value are in that order on the line with a delimiter between: space, comma, tab, colon, pipe long vertical mark. Then another command can...
11,391
Posted By anbu23
$ awk -F'[<>]' ' /tns:name/ || /tns:value/ {...
$ awk -F'[<>]' ' /tns:name/ || /tns:value/ { print $3 } ' file
AdminOutQueue
WBIA.SMRPSC1.ADOUTQ
AgentTraceLevel
5
11,391
Posted By DGPickett
It sounds like you want to just ignore lines that...
It sounds like you want to just ignore lines that do not have those tags. If the data conveniently has line feeds after every close or all element tag and not after any interesting open element...
Showing results 1 to 16 of 16

 
All times are GMT -4. The time now is 11:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy