Search Results

Search: Posts Made By: theflamingmoe
8,538
Posted By summer_cherry
python
a=[]
with open("a.txt") as f:
for line in f:
words = line.split(",")
a.append(words[1::3])
for i in range(len(a)):
if(i==0):
pass
else:
for j in range(len(a[0])):
...
8,538
Posted By MR.bean
bash-3.2$ cat txt ...
bash-3.2$ cat txt
source,cu_001,cu_001_volume,cu_001_mass,cu_002,cu_002_volume,cu_002_mass,cu_003,cu_003_volume,cu_003_mass
ja116,1.33,3024000,9374400,1.54,3026200,9375123,1.98,3028000,9385512
...
1,467
Posted By Don Cragun
It isn't a syntax error, but it isn't common. ...
It isn't a syntax error, but it isn't common. The awk printf command:
printf "%s" OFS,$i
uses the concatenation of "%s" and OFS as a format string; together they print the contents of the ith...
12,689
Posted By elixir_sinari
Slight refinement to prevent unnecessary...
Slight refinement to prevent unnecessary replacements:
awk -F_ '{for(i=1;i<=NF;i++){if(sub(/^[0-9]+\.[0-9]+$/,"&",$i)){sub(/0+$/,"",$i);sub(/\.$/,"",$i)}}}1' OFS=_ file


This will trim the...
12,689
Posted By Subbeh
Try this: sed...
Try this:

sed 's/0*_/_/g;s/0*$//;s/\._/_/g;s/\.$//'

Could probably be done better, but it does the trick
12,689
Posted By rangarasan
Hi, Try this out, sed 's/\.*00*$//'...
Hi,

Try this out,


sed 's/\.*00*$//' file




@Ashik409: You have to consider the highlighted.

Cheers,
Ranga :)
1,299
Posted By elixir_sinari
awk '{printf("%s OR109_%04d\n",$0,NR%2?++i:i)}'...
awk '{printf("%s OR109_%04d\n",$0,NR%2?++i:i)}' inputfile
9,317
Posted By Scrutinizer
Have you tried setting the standard variable...
Have you tried setting the standard variable TMPDIR instead of "TMP" ? If that does not help (it should) then your sort may have a -T option so you can set the temporary sort directory explicitly.
9,317
Posted By rangarasan
gawk
Why cant you use asort function in gawk to sort out your file content?
Redirection have some limitations, i think. Do your all sorting in gawk itself.
Cheers,
ranga:-)
1,419
Posted By rdcwayx
If you need export a CSV style file, you are...
If you need export a CSV style file, you are correct to set OFS, but use it in wrong way. Try this:

awk '{print $2 OFS $3}' OFS="," geo_met_checks_stope.asc >> junk.csv

But if you export $0...
1,419
Posted By rdcwayx
any problem by this ? awk '{print $2}'...
any problem by this ?

awk '{print $2}' geo_met_checks_stope.txt
Showing results 1 to 11 of 11

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