Search Results

Search: Posts Made By: usha rao
1,310
Posted By Franklin52
Another approach: awk -F, '!$1{$1=s}{s=$1}1'...
Another approach:
awk -F, '!$1{$1=s}{s=$1}1' OFS=, file
1,310
Posted By agn
Try: awk -F',' 'BEGIN { OFS=","; p=0 } $1...
Try:


awk -F',' 'BEGIN { OFS=","; p=0 } $1 != 0 { p = $1 } { $1 = p }1' file
1,310
Posted By balajesuri
awk -F',' 'NR==1 {p=$1} {if($1 == 0) {$1=p} else...
awk -F',' 'NR==1 {p=$1} {if($1 == 0) {$1=p} else {p=$1}}1' file
5,780
Posted By hergp
To keep it simple, just use mv -- -9file.jpg...
To keep it simple, just use

mv -- -9file.jpg 9file.jpg
The special option "--" can be used to delimit the end of the options. This is useful in delimiting non-option arguments that...
5,780
Posted By rangarasan
find
Hi,

Try this one,


find . -name "-9file.jpg" | xargs -I '{}' mv {} 9file.jpg


Cheers,
Ranga:)
2,224
Posted By rangarasan
awk
Hi,
Try this,
awk -F: '/myregex/ {gsub(/\//,"",$2);split($2,a,"."); print a[1];}' input_file
cheers,
Ranga:-)
2,224
Posted By itkamaraj
awk -F"[:/]" '/myregex/ { print $(NF-2)}'...
awk -F"[:/]" '/myregex/ { print $(NF-2)}' mytest.txt
2,224
Posted By shamrock
No need to cat mytest.txt... awk -F: '/myregex/...
No need to cat mytest.txt...
awk -F: '/myregex/ { print $2}' mytest.txt | sed 's;/\{1,\};;'
2,224
Posted By yazu
echo '//mytestserver.bon.com' | sed -r 's...
echo '//mytestserver.bon.com' | sed -r 's //([^.]*).* \1 '
mytestserver
;)
2,966
Posted By jayan_jay
Hope this clears :)
Hope this clears :)
2,966
Posted By jayan_jay
alternate one .. #!/bin/bash nawk -F\|...
alternate one ..

#!/bin/bash
nawk -F\| '{if(a[$1]==a[$1]);if($6!= "") {print $0 >"with_val"} else {if(a[$1]==a[$1]);if($6== "" ) {print $0 >"without_val"}}}' inputfile
nawk -F"|" '{ if ( $6!= ""...
18,986
Posted By Franklin52
@ctsgnb, The command also prints the line...
@ctsgnb,

The command also prints the line after the last regex.
Shouldn't it be?
awk '/one/{f=1;x=NR}f{A[++c]=$0}END{while(++d<x-1)print A[d]}' input

Another approach:
awk '/xyz/{if(s){print...
18,986
Posted By Franklin52
Another one with awk: awk 'f &&...
Another one with awk:
awk 'f && /one/{print;exit}/one/{f=1}f' file
18,986
Posted By panyam
Hello Usha, How about this? awk -v...
Hello Usha,

How about this?

awk -v c=0 '/xyz/&&c++<1 {a=$0;next} /xyz/&&c>0 { a=a"\n"$0;f=a;next} c>0 {a=a"\n"$0;next} END { print f}' input_file
18,986
Posted By getmmg
Is this what you are looking for Input: this...
Is this what you are looking for
Input:
this is test
one
two
three
four
two
one
end of file


"one" is the search string here.

Code:
perl -0ne 'print $1 if /one(.*)one/sg' test
...
4,808
Posted By Corona688
You'll want a CPU with virtualization/hypervisor...
You'll want a CPU with virtualization/hypervisor support of course, but beyond that, hardware requirements for a small home server really aren't that bad. The more RAM the better, though that's true...
4,808
Posted By bartus11
I would say go for PC version. To be more...
I would say go for PC version. To be more precise, go for Solaris installed in VirtualBox or VMware. IMO, for testing/learning purposes it is much better solution. If you break something, you can...
17,479
Posted By ctsgnb
Could you please copy paste all that you have as...
Could you please copy paste all that you have as input as well as result of the command ?

---------- Post updated at 01:34 PM ---------- Previous update was at 01:33 PM ----------

try the same...
112,685
Posted By drl
Hi. An available utility, numsum, part of...
Hi.

An available utility, numsum, part of num-utils:
#!/usr/bin/env bash

# @(#) s1 Demonstrate use of numsum.

# Utility functions: print-as-echo, print-line-with-visual-space, debug.
pe()...
112,685
Posted By Klashxx
Try this ( don't know if your system will handle...
Try this ( don't know if your system will handle it ):
awk '{for (i=1;i<=NF;i++){a[i]+=$i;if (i>max){max=i}}}END{for (j=1;j<=max;j++){print a[j]}}' file
Forum: Filesystems, Disks and Memory 04-26-2011
17,185
Posted By Corona688
The best 'guide' is man mmap and some...
The best 'guide' is man mmap and some experimentation.

The "magic" is virtual memory. If you don't understand that yet, you'll need to. the paging game...
19,063
Posted By coolguru
should be aliased....check your .profile.you...
should be aliased....check your .profile.you should find something like alias rm='xyz'...where xyz could rm -i or a script you have placed else where.
Are you running as root?
15,029
Posted By frans
getting parameters in a function is the same as...
getting parameters in a function is the same as in a script. If you call the script like InsertRecord "$OLD_VAL" "$NEW_VAL" "$DATE"
you can retrieve the values inside the function (as in your...
6,768
Posted By bartus11
Does it have to be sed? perl -pe...
Does it have to be sed?
perl -pe 's/(?<![a-z])jo(?![a-z])/bo/ig' file
25,300
Posted By cfajohnson
{ echo "<table>" printf...
{
echo "<table>"
printf "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n" $(cat "$file")
echo "</table>"
} > table.html
Showing results 1 to 25 of 25

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