Search Results

Search: Posts Made By: krsnadasa
7,710
Posted By RudiC
sed only: sed -rn 's/^ *| *$//; /...
sed only:
sed -rn 's/^ *| *$//; / *\\Start/,/^$/ {H; /^$/ {g;s/\n//g;p;s/.*//;h; };}; $ {g;s/\n//g;p;}' file
\Start\now\fine stepwatch this space for tools ends here
\Start\then\go language...
7,710
Posted By Scrutinizer
Try: awk '/\\Start/{f=1} !NF{if(f)print s; s=x;...
Try:
awk '/\\Start/{f=1} !NF{if(f)print s; s=x; f=0} f{s=s $0} END{if(f) print s}' file
\Start\now\fine step watch this space for tools ends here
\Start\then\go language again cubernates...
7,710
Posted By pilnet101
You can try this, it is probably a lot more...
You can try this, it is probably a lot more complicated that in needs to be but it seems to work. It trims the leading spaces before \Start as well so if that is undesired then it can be changed.
...
2,692
Posted By vbe
Its more how you used your zip tool you should...
Its more how you used your zip tool you should look to find why you have PATH included... and htta you dont mention...
1,260
Posted By RavinderSingh13
Hello krsnadasa, Following is the...
Hello krsnadasa,

Following is the explanation for above code, hope it may help you in same.

awk -F"|" ' ######## Making field seprator as |
!arr[$1]++ ...
27,576
Posted By Aia
${f} is the same that $f, the variable, right? ...
${f} is the same that $f, the variable, right?
There are two parts in shell expansion ${f%.*}, the `%' and the glob pattern `.*' (this is not a regular expression), in this case a dot followed by...
27,576
Posted By RudiC
man bash:
man bash:
1,849
Posted By RudiC
Actually, it's a grep version. The sed command...
Actually, it's a grep version. The sed command just makes sure grep is working on the first field by adding the needed regex parts (no spaces up to the name, trailing space).
1,849
Posted By RudiC
How about sed 's/^/^[^ ]*/;s/$/ /' pattern |...
How about sed 's/^/^[^ ]*/;s/$/ /' pattern | grep -f- content
1,849
Posted By Klasform
I have been trying to solve this through sed. ...
I have been trying to solve this through sed.
inline!
sed -n -e '/\@{sed -e '1p' pattern.txt}/p' content.txtAlso tried curlys with many other combination, just can't get it working.
I Like the...
1,849
Posted By Aia
An Awk version awk ' FNR==NR { ...
An Awk version
awk '
FNR==NR { # prevents loading Content.txt into array s
s[$0] # load Pattern.txt file into array s
next ...
1,849
Posted By cjcox
How about: #!/bin/sh #awkcode=`sed...
How about:


#!/bin/sh

#awkcode=`sed 's,\(.*\),$1 ~ /\1/ { print $0 },' <Pattern.txt`
awkcode=`sed 's,\(.*\),$1 ~ /@\1$/ { print $0 },' <Pattern.txt`

awk "
$awkcode
" <Content.txt

...
2,640
Posted By RudiC
Try awk 'NR==1 {n = split (KW, TMP,...
Try awk 'NR==1 {n = split (KW, TMP, ",")
for (; n>0; n--) PAT[TMP[n]]
}
{T=$1; sub (/^ */, "", T)}
T...
2,640
Posted By RavinderSingh13
Hello krsnadasa, Following may help you,...
Hello krsnadasa,

Following may help you, could you please check and let me know.

awk '{gsub(/^ +/,X,$0);n = split (KW, TMP, ",")
for (; n>0; n--) PAT[TMP[n]]
...
1,657
Posted By RudiC
Trydf -kh .|awk 'NR==1 {split($0,B);next} {for...
Trydf -kh .|awk 'NR==1 {split($0,B);next} {for (i=1;i<=NF;i++) print B[i],"-->",$i}'
3,219
Posted By guruprasadpr
Hi You should source the script, not run...
Hi

You should source the script, not run the script like a command.

if in bash:
$ source script_name

for ksh:
. scriptname

Moreover, the script may not help you much since the...
3,670
Posted By elixir_sinari
Yes, the comma is needed to make use of OFS. ...
Yes, the comma is needed to make use of OFS.
No, it will not "default" as a space but if the 2 fields are "glued" together in the print statement without the comma, the output will also be "glued"...
1,978
Posted By elixir_sinari
sed will never match a "terminal" new-line. To...
sed will never match a "terminal" new-line. To make it match a "terminal" new-line, you need to create a multi-line pattern space so that the "terminal" new-line of first line becomes an "embedded"...
7,460
Posted By rangarasan
Hey Hi.. v[$3] is the key here. It stores...
Hey Hi..

v[$3] is the key here. It stores the current line, before store the current line we are having previous line.

Example1:
1234|1|Jon|some text|some text
1234|2|Jon|some text|some...
5,350
Posted By Scrutinizer
I think I wrote that a bit quickly. It is...
I think I wrote that a bit quickly. It is correct, but probably this equivalent code is probably somewhat easier to understand:
awk '$2{print RS $0}' FS='\n' RS=\> ORS= infile
This means:

use...
2,104
Posted By Scrutinizer
Because that means something else. In awk...
Because that means something else. In awk language that means:
"print a string that consists of the variables i and to and the array element A[""]"
, which all are uninitialized and so an empty...
2,183
Posted By itkamaraj
-F"[><]" --> we are giving two field seperator...
-F"[><]" --> we are giving two field seperator >< ( if any one occurs, then field will be seperated )
1,818
Posted By Scrutinizer
Sure: awk ' # For every line...
Sure:
awk ' # For every line in file2
getline p<f { # if reading the next line from the file in variable f (containing the name of file1) into variable p is successful
...
1,992
Posted By yazu
cat FILE | paste - - | sed 's/ Name//'
cat FILE | paste - - | sed 's/ Name//'
1,992
Posted By itkamaraj
a=$1 --> a will hold the first field ...
a=$1 --> a will hold the first field
a=a""substr($2,length($2)-1,length($1)) --> append the last character of second filed with a
getline --> read the next line ( so that $0 will be having the...
Showing results 1 to 25 of 28

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