Sponsored Content
Top Forums Shell Programming and Scripting Column with New Line in CSV file Post 302916318 by Yoda on Monday 8th of September 2014 05:23:24 PM
Old 09-08-2014
Code:
awk -F, '
        # if NF not equal to 7
        NF != 7 {
                # If ORS not equal to " " set ORS = " " else set ORS = RS (newline by default)
                ORS = ( ORS != " " ? " " : RS )
        }
        {
                # This stmt rebuilds current record, this is to set OFS = |
                $1 = $1
        }
        # 1 == true. If true, default awk operation is to print current record
        1
' OFS=\| file

This User Gave Thanks to Yoda For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

read a line from a csv file and convert a column to all caps

Hello experts, I am trying to read a line from a csv file that contains '.doc' and print the second column in all caps. e.g. My csv file contains: Test.doc|This is a Test|test1|tes,t2|test-3 Test2.pdf|This is a Second Test| test1|tes,t2|t-est3 while read line do echo "$line" |... (3 Replies)
Discussion started by: orahi001
3 Replies

2. Shell Programming and Scripting

Remove line feed from csv file column

Hi All, My requirement is to remove line (3 Replies)
Discussion started by: r_t_1601
3 Replies

3. Shell Programming and Scripting

Remove line feed from csv file column

Hi All, i have a csv file . In the 7th column i have data that has line feed in it. Requirement is to remove the line feed from the 7th column whenever it appears There are 11 columns in the file C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 The value in C7 contains line feed ( Alt + Enter ),... (2 Replies)
Discussion started by: r_t_1601
2 Replies

4. Shell Programming and Scripting

Replace 2nd column of CSV file with numbers on line

I have a csv file with occasional multiple entries in the second column. 111111,104,07-24-2011,3.15,N, 222222,020 140,07-24-2011,10.00,N,I want the result 111111,104,07-24-2011,3.15,N, 222222,020,07-24-2011,10.00,N, 222222,140,07-24-2011,10.00,N, I know I can get the output of the second... (5 Replies)
Discussion started by: ffdstanley
5 Replies

5. Shell Programming and Scripting

Replace 2nd column for each line in a csv file with fixed string+random number

Hi experts, My csv file looks like this U;cake;michael;temp;;;; U;bread;john;temp;;;; U;cocktails;sarah;temp;;;; I'd like to change the value fo 2nd column to cf+random number , which will look maybe something like this U;cf20187;michael;temp;;;; U;cf8926;john;temp;;;;... (7 Replies)
Discussion started by: tententen
7 Replies

6. Shell Programming and Scripting

Extract Line and Column from CSV Line in ksh or bash format

Hi, I was doing some research and can't seem to find anything. I'm trying to automate a process by creating a script to read a csv line and column and assigning that value to a variable for the script to process it. Also if you could tell me the line and column if it's on another work ... (3 Replies)
Discussion started by: vpundit
3 Replies

7. Shell Programming and Scripting

Remove the values from a certain column without deleting the Column name in a .CSV file

(14 Replies)
Discussion started by: dhruuv369
14 Replies

8. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

9. Shell Programming and Scripting

Get maximum per column from CSV file, based on date column

Hello everyone, I am using ksh on Solaris 10 and I'm gathering data in a CSV file that looks like this: 20170628-23:25:01,1,0,0,1,1,1,1,55,55,1 20170628-23:30:01,1,0,0,1,1,1,1,56,56,1 20170628-23:35:00,1,0,0,1,1,2,1,57,57,2 20170628-23:40:00,1,0,0,1,1,1,1,58,58,2... (6 Replies)
Discussion started by: ejianu
6 Replies
PORTABASE(1)						      General Commands Manual						      PORTABASE(1)

NAME
portabase - an easy-to-use personal database application SYNOPSIS
portabase [ -h | --help | <file> ] portabase command [ -p password ] [ options ] <fromfile> <tofile> DESCRIPTION
PortaBase (portable database) is a personal database application that is available for many platforms, including Linux, Mac OS X, Windows, and Maemo. PortaBase's features include: - One data table per file - String, Integer, Decimal, Boolean, Note (multi-line text), Date, Time, Calculation, Sequence, Image, and Enum column types - Add, edit, and delete rows of data - Custom data views (subsets of the columns in any order) - Filter the displayed rows using sets of conditions - Sort the rows by any combination of columns, each in ascending or descending order - Optional page navigation buttons, with a custom number of rows per page - Add, delete, rearrange, and rename columns at any time - Specify default values for columns - View summary statistics for columns (total, average, min, max, etc.) - Import data from CSV, XML, and MobileDB files - Export data to CSV and XML files - Command-line format conversions (to and from XML, from MobileDB) - Data file encryption - Unicode support - Pick any available font to use throughout the application COMMANDS
PortaBase uses the following commands to indicate a command-line file conversion: fromxml Create a new PortaBase file from the input XML file. frommobiledb Create a new PortaBase file from the input MobileDB file. fromcsv Add rows to an existing PortaBase file from the input CSV file. toxml Create a new XML file from the input PortaBase file. tocsv Create a new CSV file from the input PortaBase file. If an encrypted PortaBase file is to be read or created, the following option can be used immediately after the command: -p <password> Open or create the encrypted PortaBase file using the given password The toxml and tocsv commands accept the following options: -v <view> Apply the named view before exporting. -s <sorting> Apply the named sorting before exporting. -f <filter> Apply the named filter before exporting. The fromcsv command supports one option: -e <encoding> Specifies the text encoding of the imported CSV file; options are UTF-8 (the default) and Latin-1. OPTIONS
PortaBase accepts the following options: -h, --help Display usage instructions. FILES
$HOME/.qt/portabaserc - user-specific settings. Stores information on font, checkbox editing, delete confirmations, etc. AUTHOR
This manual page was written by Jeremy Bowman <jmbowman@alum.mit.edu>, for the Debian GNU/Linux system (but may be used by others). April 16, 2010 PORTABASE(1)
All times are GMT -4. The time now is 05:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy