Sponsored Content
Top Forums Shell Programming and Scripting Print rows based on separator Post 302941823 by RudiC on Tuesday 21st of April 2015 12:52:45 PM
Old 04-21-2015
Try
Code:
awk     '
    {gsub (/  +/,",&")
     sub  (/  +/,"&\"")
     sub  (/,  +[^ ]*$/,"\"&")
    } 
1
' file
68078971,    "dance routine (jess far back corner)",    13902786
368079527,    "dance routine",    13902786
368081191,    "dance routine (jess far back)",    13902786

I'm afraid I can't replicate your " ," in line two without tremendous effort...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk field separator or print command

Hello Experts, I am back, with another doubt. I am not sure what it relates to this time - awk or the print command actually. I'll explain the scenario: I have a huge file, and it has some traces(logs). In between those logs, there are statements with some SQL queries. All I want to do is... (4 Replies)
Discussion started by: hkansal
4 Replies

2. Shell Programming and Scripting

delete rows in a file based on the rows of another file

I need to delete rows based on the number of lines in a different file, I have a piece of code with me working but when I merge with my C application, it doesnt work. sed '1,'\"`wc -l < /tmp/fileyyyy`\"'d' /tmp/fileA > /tmp/filexxxx Can anyone give me an alternate solution for the above (2 Replies)
Discussion started by: Muthuraj K
2 Replies

3. Shell Programming and Scripting

How to fetch rows based on line numbers or based on the beginning of a word?

I have a file which will have rows like shown below, ST*820*316054716 RMR*IV*11333331009*PO*40.31 REF*IV*22234441009*xsss471-2762 DTM*003*091016 ENT*000006 RMR*IV*2222234444*PO*239.91 REF*IV*1234445451009*LJhjlkhkj471-2762 </SPAN> DTM*003* 091016 RMR*IV*2223344441009*PO*40.31... (18 Replies)
Discussion started by: Muthuraj K
18 Replies

4. Shell Programming and Scripting

awk, string as record separator, transposing rows into columns

I'm working on a different stage of a project that someone helped me address elsewhere in these threads. The .docs I'm cycling through look roughly like this: 1 of 26 DOCUMENTS Copyright 2010 The Age Company Limited All Rights Reserved The Age (Melbourne, Australia) November 27, 2010... (9 Replies)
Discussion started by: spindoctor
9 Replies

5. Shell Programming and Scripting

Rename a file based on a specific separator

Hello, I am new to shell I have a folder which contains a list of files, all the files contain the separator : I need to replace this character for all the filenames (by batch) ex: hello:world should become hello-world please help Thanks (3 Replies)
Discussion started by: sikilaklak
3 Replies

6. UNIX for Dummies Questions & Answers

merging rows into new file based on rows and first column

I have 2 files, file01= 7 columns, row unknown (but few) file02= 7 columns, row unknown (but many) now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there e.g. file 01 James|0|50|25|10|50|30... (1 Reply)
Discussion started by: A-V
1 Replies

7. Shell Programming and Scripting

Grep or print each section of a file on one line with a separator

I can obtain information from itdt inventory command however it display as below, I'd like to print each entity on one line but seperated by : the file is something like and each section ends with Volume Tag Drive Address 256 Drive State ................... Normal ASC/ASCQ... (3 Replies)
Discussion started by: gefa
3 Replies

8. Shell Programming and Scripting

Use two field separator in the same line and print them

Hi Guys, I have the file --- HOST_NAME,data_coleta,data_carga,CPU_util,CPU_idle,run_queue,memory,MEMORY_SYSTEM,MEMORY_TOTAL,MEMORY_SWAPIN,MEMORY_SWAPOUT,DISK_READ,DISK_WRITE,DISK_IO,NET_IN_PACKET, NET_OUT_PACKET... (4 Replies)
Discussion started by: antoniorajr
4 Replies

9. Shell Programming and Scripting

Create multiple files from single file based on row separator

Hello , Can anyone please help me to solve the below - Input.txt source table abc col1 char col2 number source table bcd col1 date col2 char output should be 2 files based on the row separator "source table" abc.txt col1 char (6 Replies)
Discussion started by: Pratik4891
6 Replies

10. Shell Programming and Scripting

Pivot Rows to Columns, with field separator

Hi All, I have a requirement to flatten data out, based on the value in COL_2. Our file is pipe delimited, however COL_2 contains a comma separated string, which we would like to pivot out from one row into multiple rows. Please see my example input data below: Input Data ... (4 Replies)
Discussion started by: RichZR
4 Replies
MooseX::Types::VariantTable::Declare(3pm)		User Contributed Perl Documentation		 MooseX::Types::VariantTable::Declare(3pm)

NAME
MooseX::Types::VariantTable::Declare - Declarative sugar for MooseX::Types::VariantTable based methods. SYNOPSIS
package Awesome; use Moose; variant_method dance => Item => sub { # Item is the least derived type in the hierarchy, # every other type subtypes it # this is in effect a fallback return "fallback"; }; # a more specific type variant_method dance => Ballerina => sub { my ( $self, $ballerina, @args ) = @_; $ballerina; # a value that passed the TC named "Ballerina" return "pretty!"; }; # also works with objects variant_method dance => $type_object => sub { ... }; DESCRIPTION
This module provides declarative sugar for defining Moose::Meta::Method::VariantTable methods in your Moose classes and roles. These methods have some semantics: Declaration The order of the declarations do not matter in most cases. It is the type hierarchy that defines the order in which the constraints are checked and items dispatched. However, in the case that two constraints without an explicit relationship between them (one is a subtype of the other) both accept the same value, the one that was declared earlier will win. There is no way around this issue, so be careful what types you use especially when mixing variants form many different sources. Adding the same type to a variant table twice is an error. Inheritence When dispatching all of the subclass's variants will be tried before the superclass. This allows shadowing of types from the superclass even using broader types. Roles ... are currently broken. Don't use variant table methods in a role, unless that's the only definition, because in the future variant table merging will happen at role composition time in a role composition like way, so your code will not continue to work the same. perl v5.10.1 2011-02-27 MooseX::Types::VariantTable::Declare(3pm)
All times are GMT -4. The time now is 10:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy