Search Results

Search: Posts Made By: necroman08
1,945
Posted By necroman08
Yea :), thanks is great. I was thinking I have to...
Yea :), thanks is great. I was thinking I have to compare years, then months and then days; but because of the format of the date this is enought.
1,945
Posted By necroman08
Compare dates
Need to find all records where date in one filed is greater than date in other.

Input:

ABC 2 Filed3 CDG * X 20080903 20081031 180.00
ABD 2 Filed3 CDG * X 20081101 20081031 190.00
ABE 2...
1,440
Posted By necroman08
If you wont to take the last instance instead of...
If you wont to take the last instance instead of first one in column 2, you can do it like that:


sort -r file | uniq -s11 -w5 | sort


But than the output looks like this:

2009-01-03...
2,733
Posted By necroman08
If you donīt wont to output the trailing newline,...
If you donīt wont to output the trailing newline, you have to use -n option with echo.

Like:

echo -n A
echo -n B
echo -n C
1,677
Posted By necroman08
This way you ignore OR. With your code both...
This way you ignore OR. With your code both fileds (26-27) AND (28-29) have to be true. If I understud it good, itīs enought that one condition is satisfied.


grep -E...
1,753
Posted By necroman08
sed 's/defer/deferred/' file
sed 's/defer/deferred/' file
6,496
Posted By necroman08
O yes, I forgot about that that. So: echo...
O yes, I forgot about that that. So:

echo -n "Count: " > file2.txt; echo $( expr `wc -l file.txt | cut -d' ' -f1` - 1) >> file2.txt


Ok, itīs not so elegant as yourīs :o
6,496
Posted By necroman08
echo -n "Count:" > file2.txt; wc -l file.txt |...
echo -n "Count:" > file2.txt; wc -l file.txt | cut -d' ' -f1 >> file2.txt
19,480
Posted By necroman08
With cut: cut -d' ' -f1-17 file
With cut:
cut -d' ' -f1-17 file
2,774
Posted By necroman08
grep -o "b\([=0-9]\)\+" inputfile
grep -o "b\([=0-9]\)\+" inputfile
1,529
Posted By necroman08
Yep, your right, itīs a little bit terrible.
Yep, your right, itīs a little bit terrible.
14,150
Posted By necroman08
tr ' ' '\n' < file.txt | sort | uniq | grep -v...
tr ' ' '\n' < file.txt | sort | uniq | grep -v "^$"
or better if you have some other numbers that are not starting with 0032
tr ' ' '\n' < file.txt | sort | uniq | grep "^0032"
or
grep -o...
9,110
Posted By necroman08
I also use cygwin. When I copyed your code, it...
I also use cygwin. When I copyed your code, it worked.
1,529
Posted By necroman08
#!/bin/bash read file1 read file2 while...
#!/bin/bash
read file1
read file2
while read line
do
n1=`echo $line | awk '{ print $2 }'`
l1=`echo $line | awk '{ print $1 }'`
n2=`grep ^${l1} $file2 | awk '{ print $2 }'`
echo $l1 `expr...
1,727
Posted By necroman08
grep -v ^ INPUT_FILE >>OUTPUT_FILE
grep -v ^
INPUT_FILE >>OUTPUT_FILE
17,496
Posted By necroman08
I got it! cat f field 12345 12345 a ...
I got it!

cat f

field 12345 12345 a
field 12345 a
field 12345 123456 a
field 12345 12345


grep "^field [0-9]\{1,5\}\( [0-9]\{1,5\}\|\) [a-z]$" f

field 12345 12345 a
field 12345 a...
17,496
Posted By necroman08
Thankīs man. But canīt you do this somehow with...
Thankīs man.
But canīt you do this somehow with grep and reg. expressions? I have checked man for grep and I see speciall characters like "?" could be helpfull, but I donīt know how to used it.
...
17,496
Posted By necroman08
I wont: field 12345 12345 a field 12345 a...
I wont:

field 12345 12345 a
field 12345 a

But with grep "^field [0-9]\{5\} [0-9]\{0,5\} [a-z]$" file I get:

field 12345 12345 a
17,496
Posted By necroman08
Great, thanks this works. But what if this field...
Great, thanks this works. But what if this field is not the last one in the row. Like this:

field 12345 12345 a
field 12345 a
field 12345 123456 a

In that case this īguyī dos not work:...
17,496
Posted By necroman08
grep with regular expression optional value
field 12345 12345
field 12345
field 12345 123456

last fleld (from three) is optional, but if it occures It has to be composed only of nummbers and maximum 5 positions long.

If I use:
...
4,240
Posted By necroman08
Yea sorry. Wrote it wrongly, it should be: sort...
Yea sorry. Wrote it wrongly, it should be: sort file | unig -d.
Wrote rubbish first time, that is because stres https://www.unix.com/images/icons/icon11.gif

---------- Post updated at 04:07 AM...
4,240
Posted By necroman08
How to delete lines in a file that have duplicates or derive the lines that aper once
Input:
a
b
b
c
d
d
I need:
a
c
I know how to get this (the lines that have duplicates) :
b
d
sort file | uniq -d

But i need opossite of this. I have searched the forum and other...
5,267
Posted By necroman08
That's right.
That's right.
5,267
Posted By necroman08
How to replace character on defined position
I need to replace the character on 6th position. If this character is 1 I have to repleace it with A, if it is 2 than I have to replace it with B. If it is not 1 or 2 I should not repleace it.
...
2,529
Posted By necroman08
Thanks, that is what I need. I have just one...
Thanks, that is what I need.
I have just one problem. In my file, lines contain * character. Line of a file look like this: somethink * wordnumber1234something something.

If I try this in shell:...
Showing results 1 to 25 of 27

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