Search Results

Search: Posts Made By: gr8_usk
3,677
Posted By ongoto
Don't see LINUX or LVM in the output of fdisk -l....
Don't see LINUX or LVM in the output of fdisk -l. Maybe you are using other than GNU Linux?

What I see here...
NewDisk=`fdisk -l | grep Linux | egrep -v '\*|LVM' |awk '{print $1}' | sed...
3,677
Posted By Corona688
If you're doing grep | sed | grep -v | awk | sed...
If you're doing grep | sed | grep -v | awk | sed | cut | kitchen | sink, just use awk and be done with it.

fdisk prints 'Linux' on my system, not LINUX, but adjust to taste.

$ fdisk -l | awk...
3,677
Posted By Scrutinizer
In sed you can replace the slash of the...
In sed you can replace the slash of the substitute command with almost any character .
$ echo "Turn forward // into dashes" | sed 's/\//-/g'
Turn forward -- into dashes

Using | instead of / :...
5,668
Posted By Yoda
Just put the code in one line! awk...
Just put the code in one line!
awk 'NF{if($0~/Six/){H=$0;sub(/Six:[ \t]*/,X,H)}else{gsub("\t",X,$0);S=S?S OFS $0:$0}next}!NF{print H,S;S=""}END{print H,S}' OFS=, file
5,668
Posted By RudiC
Tryawk '{gsub("[\t ]*","");$1=$6"\t"$1; sub...
Tryawk '{gsub("[\t ]*","");$1=$6"\t"$1; sub (/^[^:]*:/,"",$1); $6=""}1' RS= ORS="\n" FS="\n" OFS="," file
8,721
Posted By yazu
Try: sed 's/^\(...\) \(...\)...
Try:
sed 's/^\(...\) \(...\) \([0-9][0-9]\).*2011/\2 \3 2011/' INPUTFILE
It works only for 2011 year but it's easy enough to fix this.

PS And you should'n have other "2011" in your strings.
21,902
Posted By kshji
You can use also builtin calculation, tested...
You can use also builtin calculation, tested using ksh and bash

echo $(( 10+RANDOM%21 ))
# or more generic
min=10
max=30
((diff=max-min+1))
echo $(( min + RANDOM%diff ))
6,310
Posted By birei
Hi, Using 'perl': $ perl -pe...
Hi,

Using 'perl':

$ perl -pe 's/\s*,\s*/,/g' infile
Sat Jul 23 16:10:03 EDT 2011,12345678,PROD,xyz_2345677,testuuyt,149693,abtryu
Jul 22 2011,NULL,PROD,yt12345,testuuytoy,162469,abtryu
Jul...
6,310
Posted By michaelrozar17
Through Sed.. sed 's/ *, */,/g' inputfile
Through Sed..
sed 's/ *, */,/g' inputfile
21,902
Posted By panyam
echo "10+$RANDOM%10*(2)+2 " | bc will...
echo "10+$RANDOM%10*(2)+2 " | bc

will generate random numbers in 12~30 range, if that suffice.
8,620
Posted By panyam
Oh God, You changed the order!!! try ...
Oh God,

You changed the order!!!

try


MM="Jul"
DD=20
nawk -v d=$DD -v m=$MM '$2==m && $3==d' input_file
1,704
Posted By Franklin52
awk -F# '{gsub(".","x",$NF)}1' OFS=#...
awk -F# '{gsub(".","x",$NF)}1' OFS=# file
2,650
Posted By Franklin52
This command should do the job: awk...
This command should do the job:
awk '/--/;/\/\*/{p=1};p;/\*\//{p=0}' file
This is the output I get:
$ cat file
Tue Mar 25 23:35:00 GMT 2008
-- COMMENT Tue Mar 25 21:34:23 GMT 2008
Tue Mar 25...
1,427
Posted By Skrynesaver
This should do it. awk -F'--' '{print...
This should do it.


awk -F'--' '{print $1}' $ORACLE_CODE_FILENAME
removing blank lines is left as an exercise for the reader ;)
3,117
Posted By mirni
Oh my... ok, let me give it a shot: ...
Oh my... ok, let me give it a shot:

#!/bin/ksh
#%W% %I% %D% %T% ---- these are comments (starting with #)
#%W%G --- they don't do anything

The beginning of this line here://g'
Seems like...
8,614
Posted By Perderabo
You can use od to show the last characacter of a...
You can use od to show the last characacter of a file.
$ echo -n hello > testfile1
$ echo hello > testfile2
$ file=testfile1
$ od -An -tc -j $(( $(ls -l $file | awk '{print $5}') - 1 )) $file
...
Showing results 1 to 16 of 16

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