Any solution with awk for volatile columns??


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Any solution with awk for volatile columns??
# 8  
Old 02-18-2013
Try:
Code:
awk -F'[ \t]+,[^,]+,' '$1=$1' OFS=, file

Code:
awk '{gsub(/[ \t]+,[^,]+,/,",")}1' file

Code:
perl -pe 's/\s+,.*?,/,/g' file


Last edited by Scrutinizer; 02-18-2013 at 02:57 AM..
These 3 Users Gave Thanks to Scrutinizer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with awk solution to add columns

Hi all. Wondering if someone can help with an awk solution to a problem I'm stumped with. I have a matrix file with >1000 fields and would like to add another column after each column with a text label. For example: Input: $cat file.txt name col1 col2 col3 coln aaaa ... (2 Replies)
Discussion started by: torchij
2 Replies

2. Shell Programming and Scripting

sed or awk Solution

Hi I am having a csv file like this ahsh,90.82,add,32424,ahha hhdh,98.89,hdhdh,92728,neha hshs,you,97.7,hdhdhd,are,a jsjsj,wonderful,9788,79.9,aheh ahdh,95.5,girl, 2737,jolllI need to add width="100" to the value which is greater than 90 like decimal points but less than 100 Output... (5 Replies)
Discussion started by: kshitij
5 Replies

3. UNIX for Dummies Questions & Answers

Help with solution to add together columns of large file

Hi everyone. I have a file with ~500 columns and I would like to perform a simple calculation on every two columns. The file looks like this: $cat input id A B C D E F.....X 1 2 4 2 3 4 1 n 2 4 6 4 6 4 5 n 3 4 7 5 2 2 3 n 4 ... (5 Replies)
Discussion started by: torchij
5 Replies

4. Shell Programming and Scripting

Awk solution

Hello! Well, I searched and wasn't able to find a specific example of my dilemma, so hopefully someone could assist? Or maybe there was an example but I missed it? I have two files: file1 = order data file file2 = list of 65,000+ order numbers I would like to extract from 'file1' any... (5 Replies)
Discussion started by: rm -r *
5 Replies

5. AIX

mkinstallp mark a file as volatile

I want to make a bff installp package which should be AIX5.2 compatible, but i don't know how to mark a file as volatile within the mkinstallp's template file. Anyone could help pls? (1 Reply)
Discussion started by: acerlinux
1 Replies

6. Shell Programming and Scripting

AWK solution to subtract multiple columns of numbers

Hope somebody is happy. NR==1 { num_columns=split( $0, menuend ); next; } { split( $0, substrend ); for ( i=1; i<=NF; i++ ) { minuend -= substrend; } } END { print "Result:"; for ( i=1; i<=num_columns; i++ ) { printf(... (3 Replies)
Discussion started by: awkward
3 Replies

7. Shell Programming and Scripting

Is there a awk solution for this??

I am writing a awk script that gathers certain data from certain fields. I needed a awk solution for this, because it will later become a function in the script. I have the following data that I need output on a single line, but record spans across multilple lines and records are not... (7 Replies)
Discussion started by: timj123
7 Replies

8. Shell Programming and Scripting

using awk for volatile column list

Hi guys I have my 5th column like this 12 12:00 12:13:14 5-12:13:14 Meaning 5 days 12 hrs 13 minutes and 14 seconds I need to split this column into above meaning format. But all other columns are separated by single while space. I am using awk command to print other... (8 Replies)
Discussion started by: yorker
8 Replies

9. Programming

volatile variable

give me the detail about volatile , applications, how to use volatile variable (2 Replies)
Discussion started by: vinodkumar
2 Replies

10. Programming

volatile

hi plz explain about volatile keyword in C language bye... (1 Reply)
Discussion started by: venkat_t
1 Replies
Login or Register to Ask a Question