Search Results

Search: Posts Made By: Jin_
2,289
Posted By Scrutinizer
Try: grep -E...
Try:
grep -E '§Code§string§[0-9]*[1-5]([[:blank:]]|$)' file
where § stands for that control character ^_

or perhaps just
grep -E '.Code.string.[0-9]*[1-5]([[:blank:]]|$)' file
with the dot as...
2,289
Posted By apmcd47
If you modify that grep to: grep...
If you modify that grep to:

grep Code^_string^_[0-9]+[1-5]
it should work for when only numerals appear after the Code/string construct. I have not tested this.

Andrew
2,289
Posted By ahamed101
Something like this? grep...
Something like this?

grep "_Code^_string^_[0-9]\{2\}[1-5]" infile

grep "_Code^_string^_[0-9]\{2\}[19]" infile


How many digits will you have (the above is for 3 digits)? And I suppose you...
2,606
Posted By Jotne
Yes correct. /Amount/ && /TotalSales/ Means...
Yes correct.
/Amount/ && /TotalSales/
Means line that have both Amount and TotalSales in it.
Logical and. Look at output of data in my post #6
Logical or can be used this way /Amount/ ||...
2,606
Posted By Scrutinizer
@Jotne :) Yes, but only with gawk and mawk....
@Jotne :) Yes, but only with gawk and mawk. Regular awk can only use a single character as a record separator (or two consecutive new lines if left blank)...
2,606
Posted By Jotne
@Scrutinizer I do need to remember that...
@Scrutinizer
I do need to remember that changing the Record separator i a very powerful way to do it. Tanks :)

You can even save some more:
awk '/Amount.+TotalSales/{print $2,$4,$6}' RS=Record...
2,606
Posted By Scrutinizer
gawk, mawk: awk '/Amount/ && /TotalSales/{print...
gawk, mawk:
awk '/Amount/ && /TotalSales/{print $2,$4,$6}' RS=Record OFS=, file

--
other awks:
awk '/Amount/{a=$2} /TotalSales/{t=$2} /Time/{if(a!="" && t!="") print a,t,$2; a=t=""}' OFS=, file
2,606
Posted By Jotne
Another awk awk '/Record/ {getline;if...
Another awk
awk '/Record/ {getline;if ($1!~/Amount/) next;a=$2",";getline;if ($1!~/Total/) next;a=a$2",";getline;print a$2}' file
1,0,1:00:00
10,1,1:00:00
100,11,1:00:00
2,606
Posted By krishmaths
awk '{if($1=="Record"){print a;a="Record"} else...
awk '{if($1=="Record"){print a;a="Record"} else {a=a" "$0}}' record.csv | awk 'BEGIN{print "Amount, TotalSales, Time";OFS=","} /Amount/&&/TotalSales/&&/Time/ {print $3,$5,$7}'
56,809
Posted By methyl
Does your Oracle SQL*Plus program contain a "set...
Does your Oracle SQL*Plus program contain a "set linesize" command?

Do you have default values set for SQL*Plus which might include a "set linesize" command? Look for login.sql in your home...
56,809
Posted By itkamaraj
just try this. This will remove all the...
just try this.

This will remove all the special characters except the keyboard characters
perl -i -pe 's/[^\x20-\x7f]//g' examplefile

---------- Post updated at 01:16 PM ---------- Previous...
56,809
Posted By itkamaraj
The code i provided is to remove the special...
The code i provided is to remove the special characters from the file

Dec value 128 to 225
Hex value 80 to FF

Is the output produced in windows platform ?

try


dos2unix < infile >...
56,809
Posted By itkamaraj
Try this.. tr -cd '\11\12\40-\176' <...
Try this..


tr -cd '\11\12\40-\176' < myfile1 > myfile2
56,809
Posted By guruprasadpr
Hi sed -e 's/InterUnit\$/InterUnit/g' ...
Hi

sed -e 's/InterUnit\$/InterUnit/g' file.csv > file2.csv

Guru
Showing results 1 to 14 of 14

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