Hi, i want to delete a column from a file. the file is like : 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 1|2|3|4|5|6|7|8|9|0 if i want to remove any column the outout should be like ( suppose 4): 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 1|2|3|5|6|7|8|9|0 i have used swk command, but its not giving the desired output: its giving some extra delimeters: awk 'BEGIN{FS=OFS="|"}{$4="";gsub(FS,"")}1' file please help

Member Avatar
Member Avatar
+0 forum 12

Hello everyone, I am trying to merge large number of CSV files into one, using the following "awk" command, but if I increase the number of files more than 10,000, it then gives me "argument too long" error. Can someone suggest how I can manage to go beyond the limit? I am looking to merge some ~100,000 csv files together. awk '{print $0"\t"FILENAME}' *.csv > merged.csv Thanks.

Member Avatar
Member Avatar
+0 forum 5

I am defining the following variables inside a bash script (note: I ultimately want to pass these values to the bash script from the commandline but I haven't gotten that far yet): OFS=',' INPUTFILE='~/data.txt' OUTPUTFILE='~/delimited.txt' FIELDWIDTHS='1 10 4 2 2' Next, inside the bash script I'm attempting to call an awk script and pass it these same values: echo echo | awk -v FIELDWIDTHS=$FIELDWIDTHS -v OFS=$OFS -v INPUTFILE=$INPUTFILE -v OUTPUTFILE=$OUTPUTFILE -f ~/bin/fixedWidthToDelimited.awk The awk script doesn't seem to be able to understand correctly what's being passed to it, I keep getting fatal errors. Can someone please help me understand how …

Member Avatar
Member Avatar
+0 forum 2

hello, I created a awk program to work witha data file to output a table and subtotal the rows and total up the collums and average I got it to work but when i added a presentation header before my totals go away. working code so far ------ can be viewed at http://cwl-host.com/linux/wtest and when i added the presentation headder my totals went away http://cwl-host.com/linux/test im using awk -f wtest datafile.dat

Member Avatar
Member Avatar
+0 forum 1

BEGIN { via["AIRTEL_WHITE"] = 0 via["AIRTEL_WAP"] = 0 via["_321_44"] = 0 via["_321_555"] = 0 count=0 } { for(var in via) { if($5 ~ /var/) { count++ via[var] = via[var]++; } #print $5 } } END{ for(var in via) { if(via[var] != 0) { print var "->" via[var] } } print "Completed: " count } Hello friends. I wrote a code to match the array values with the fifth field of my input file (sample record given below). `http://124.153.10131/sms/airtel_321_44?msisdn=919571774414&sessionid=13443642111972521&circleid=RJ& ` I wanted the number of times the array values matched with the above field which is $5 in the input file. …

Member Avatar
Member Avatar
+0 forum 5

For a shell script used to automatically generate c++ code files, I have to split certain names apart for them to be formatted. I split them at a capital letter, but I do not want to split if there are multiple capital letters in sequence. For example: I want this (and I get this): ChanNameWordWrapMode -> Chan Name Word Wrap Mode I want this: ChanNameVAlign -> Chan Name VAlign OSDSettings -> OSD Settings But I get this: ChanNameVAlign -> Chan Name V Align OSDSettings -> O S D Settings. The command I am using right now is: `echo $string | …

Member Avatar
Member Avatar
+0 forum 6

I am using Awk inside a bash shell script to search header files for c++ functions so I can add these functions to another file. All of the functions I need will have form: type getName() or type setName(type value) Right now I get all the functions listed in between two points in the file (between "public:" and "private:"). This works fine: variable=$(awk '/public:/ {flag=1;next}/private:/ {flag=0} flag {print}' $file) ; But when I search the resulting string, I only get everything separated by spaces (i.e. `bool getSilenceDetection()` would return as bool, getSilenceDetection() and `void setSilenceDetection(bool detection)` would return as void, …

Member Avatar
Member Avatar
+0 forum 7

CONFIG_FILE="${HOME}/sample/seq.cfg" count=`awk 'END {print NR}' $CONFIG_FILE` echo $count t=1 while [ "$t" -le "$count" ] do output_var=`awk -v v1=$t '$1 ~ /v1/ { print $1 }' $CONFIG_FILE` input_var=`awk -v v1=$t '$1 ~ /v1/ { print $3 }' $CONFIG_FILE` echo "O=" $output_var echo "I=" $input_var done the above code is giving blank values for *output_var and input_var* ?? Can someone tell me why it is not assigning values to it. the config file is as follows : 1 = 4 2 = 2 3 = 9 4 = 87 5 = 6

Member Avatar
Member Avatar
+0 forum 20

Been a long time since I've logged in and had a question, but here goes nothing! I have a file that is not delimited in any way, but I need to replace a particular column character from a space to a alphanumeric value on every other line starting at line 2; in this case an "L". Here is a quick rundown of what the file would look like vs. what I would like it to look like: Header 1234 asdf123 skip this 5678 asdf567 So, after what I'm assuming would be some sort of "awk" command to replace the 9th …

Member Avatar
Member Avatar
+0 forum 3

Hi Everyone, I need a replace a string (ex : this) with the string (ex : that) in each line of a file (sample.txt) using a C Shell Script and I am not allowed to use sed,awk and replace command in the unix , So i tried to use tr but it is replacing the character-by-character so if want anyone to help in with these. Thanks in advance. Thanks Srikanth M.

Member Avatar
Member Avatar
+0 forum 9

This is homework. I have to write a bash shell script using awk to process three delimited text files and produce a formatted report. The three files are as follows: [CODE]GRADES file John Bunyan:90:100:75:60 Maria Montessori:80:90:60:82 Alice Cooper:75:80:54:47 Harvey Mudd:89:45:89:95 PROJECTS file test1:30 test2:30 paper2:20 exam:50 LEVELS file A:89.5 B:79.5 C:69.5 D:59.5 F:0[/CODE] I hope this is fairly easy to see how these relate. The object is to go through each student, weight their grades, and output the corresponding letter grade. The awk script I have so far looks like it should work, but I am getting numerous errors, mostly …

Member Avatar
Member Avatar
+0 forum 2

consider a list of files in a particular directory(LIST A) 58623208 Sep 14 20:08 blbn_blfbe_drv 57904920 Sep 14 19:54 blbn_cycmn 55814208 Sep 14 06:02 clsa_Upd 38912000 Sep 14 19:12 cs_chgpp and in another directory (LIST B) 58623208 Sep 14 20:08 blbn_blfbe_drv 57904920 Sep 14 19:54 blbn_cycmn 55814208 Sep 14 06:02 clsa_Upd 38912000 Sep 14 19:12 cs_chgpp 41107456 Sep 14 19:17 csmRFbe 39403520 Sep 14 19:09 csmUAddAct 39235584 Sep 14 19:20 csmUAddSub where list A is a subset of list B Now I want to search for files the files which are present in LIST A in LIST B and compare …

Member Avatar
Member Avatar
+0 forum 1

I need to sum up the values of 3rd column and 4th coulmn based on the following conditions 1) If the 1st column (i.e ctpy) of the record matches with any other record && first two character of the 2nd column (ety), matches with first two character matches the 2nd column of any other record then i need to the add all the sum_m , sum_v of the matching reocrds respectively [CODE=text]ctpy ety sum_m sum_v A AA 2343.60 234.28 A BIRLA AA_Fx 1943.60 1629.28 A BIRLA AA_Der 23.00 0.00 AARTI BOM AA_FX 959.16 558.23 AARTI BOM AA_Der 854.66 654.72 ADARO …

Member Avatar
Member Avatar
+0 forum 1

After running the command [CODE] find . -name "R*VER" -mtime +1 -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \;[/CODE] my files look like this [CODE] RRR1~COS~COSMETICS~40048~jgmdtv113~1~P~R22-200~029053662549~20110607~102151.VER No error RRR1~COS~COSMETICS~ETT03~jgm14652.~3~F~R16-500~000907009757~20110607~085109.VER err 3922 [/CODE] Using the tilde (~) symbol as delimiter in the file name, can I extract the fields I want so I get an output like this [CODE] RRR1~COS~COSMETICS~40048~jgmdtv113~1~P~R22-200~029053662549~20110607~102151.VER No error RRR1 COS P RRR1~COS~COSMETICS~ETT03~jgm14652.~3~F~R16-500~000907009757~20110607~085109.VER err 3922 RRR1 COS F [/CODE] I tried the following [CODE] find . -name "R*VER" -mtime +1 -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \;|awk -F~ '{print …

Member Avatar
Member Avatar
+0 forum 4

Helo all, I wanted to parse EMBL format like file to fasta. i cannot use bioperl because this is not complete EMBL format. so please suggest me how to get this done.. [CODE] ID 013789-0068 PS TBD OO huringiensis OS ringiensis OX SI 68 RA RL 2010. OKAYAMA UNIVERSITY,JAPAN LAMB CO LTD FT source 1..1176 MT AC 67106 SV CT PN 013789 PT PROTEIN PRODUCTION METHOD, FUSION PROTEIN, AND ANTISERUM PA AMA UNIVERSITY,JAPAN LAMB CO LTD. PI HAYAKAWA TORU (JP) SAKAI, HIROSHI, HAYAKAWA, TORU P8 P4 10013789 P5 0 PC International Classification: \nUS Classification: \nEuropean Classification: C12N15/62; C07K14/47A25 PR 80199166; …

Member Avatar
Member Avatar
+0 forum 1

The End.