Search Results

Search: Posts Made By: Storms
5,384
Posted By Storms
Thanks Vryali, but as sometimes happens I...
Thanks Vryali, but as sometimes happens I discovered an answer whilst waiting for a reply... this also works:

sed 's/,\([0-9][0-9]*\),/,"\1",/g'
5,384
Posted By Storms
Put double quotes around numbers
Hi, consider a file which has data such as

"random text",912345,"54","finish"
"random text",9991236745,"9954","finish"

I want to replace the numbers that don't have double quotes around them...
27,488
Posted By Storms
awk - trim white space from a field / variable
Hi,

Consider the data (FS = |):
1| England |end
2| New Zealand |end
3|Australia|end
4| Some Made Up Country |end
5| West Indies|end

I want the output to be (i.e. without the...
813
Posted By Storms
Using awk over 2 files?
Hi,
I wanted to do a check of each record in file 1 against all the records in file 2 to find matches (or not)

so as sudo code would be something like


awk
'{
loop through each record of...
3,748
Posted By Storms
After having some issues around spaces and format...
After having some issues around spaces and format I decided to try a basic approach, so I wrote an easy to read script. It may not be the most optimal but it does the job and is easy to maintain.
...
12,858
Posted By Storms
thanks for that, after your reply i did some...
thanks for that, after your reply i did some further googling and found that \y works in place of \b in awk. I'm using this to match whole words...

so it matches good, but not gooddif (match($0,...
12,858
Posted By Storms
sorry for my denseness but how can i get it to...
sorry for my denseness but how can i get it to work in the awk script?? the following doesnt seem to match the lineif ($0 ~ /^.*\b(good|two|three)\b.*$/) { print "match" }
12,858
Posted By Storms
regular expression matching whole words
Hi

Consider the file

this is a good line

when running
grep '\b(good|great|excellent)\b' file5
I expect it to match the line but it doesn't... what am i doing wrong??
(ultimately this...
1,274
Posted By Storms
print - for printing whole line, but delimeters are changed to spaces
Hi consider the source file

R|field1|field2

using the print statement in awk prints it as
R field1 field2

Is there an easier way to print the whole line in its original format (i.e. with |...
3,748
Posted By Storms
My initial data was just an example; the data...
My initial data was just an example; the data could be:
R|This is line 1 and so
it continues|next filesd
and more| still
R|This is line2

Ahmad's gawk line works for this aswell

i.e. gives...
3,748
Posted By Storms
great stuff that works a treat i was...
great stuff that works a treat


i was gonna put a space at the beginning of each line that doesnt start with R by the following:
sed -i '/R|/!s/^/ /' file4

then run the original solution,...
3,748
Posted By Storms
I tried that... but that also gives a space at...
I tried that... but that also gives a space at the beginning of the line
i.e.
. R|This is Line1
instead of
R|This is Line1
3,748
Posted By Storms
thanks, but that still leaves me the problem of...
thanks, but that still leaves me the problem of spaces; so
R|This is
Line1
changes to
R|This isLine1

but I want
R|This is Line1

any ideas??

I guyss I could use sed to do a...
3,748
Posted By Storms
nice... thank you very much now i'll try and...
nice... thank you very much

now i'll try and figure out how that works!!

---------- Post updated at 08:38 AM ---------- Previous update was at 07:57 AM ----------

I've been playing around...
3,748
Posted By Storms
Joining lines in a file - help!
I'm looking for a way to join lines in a file; e.,g consider the following
R|This is line 1
R|This is
line 2
R|This is line 3
R|This is line 4
R|This is
line 5

what i want to end up with...
Showing results 1 to 15 of 15

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