Sponsored Content
Full Discussion: Lines with comma
Top Forums Shell Programming and Scripting Lines with comma Post 303043511 by pranabpal on Thursday 30th of January 2020 05:51:53 AM
Old 01-30-2020
Lines with comma

I have file which contains line with only comma and text separated by comma.
a.txt contain
Code:
a,ab,ac
,,
b,bc,bd
,,
,,
c,cd,ce

need to print only line 2, 4, and 5 because they only contain comma and no text.

I need an unix command to find out.

thanks in advance

Moderator's Comments:
Mod Comment Please do wrap your samples in CODE TAGS as per forum rules.

Last edited by pranabpal; 01-30-2020 at 08:25 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Joining three lines with comma separation

I have a file that looks like this: G. KRESSLAR 9618 W. APPALOOSA DRIVE SUN CITY, AZ 85373 SHIRLEY ALLEN 7272 W. VIA MONTOYA DRIVE GLENDALE, AZ 85310 LOUIS VALDEZ 244441 N. 86TH AVENUE PEORIA, AZ 85383 DONNA NEWBON 3231 W. DENTON #D PHOENIX, AZ 85017 SARAH WILSON 6534 W. PALO... (3 Replies)
Discussion started by: BCarlson
3 Replies

2. Shell Programming and Scripting

Place a comma on lines

Is it possible to place a comma in the desired places, like 10spaces after or 15 spaces after, irrespective of the contents??? Ex:File: TEST TEST: vimalthomaswants to place a comma can he do it in the desired places? as per the above file, i need to place a comma after 10th space... (4 Replies)
Discussion started by: vj8436
4 Replies

3. Shell Programming and Scripting

Script to Check & Edit Content of a file (Addition of comma in each lines of code)

Hi all, I need to write an automated bash shell script which performs such operations: 1. Grep the header of everyline with the initial of "T" in "FILE_A" 2. Perform a for loop, Count the numbers of comma in the line of code, if (no. of comma < 17) ADD the comma until 17; ... (2 Replies)
Discussion started by: big_nutz
2 Replies

4. UNIX for Dummies Questions & Answers

sort comma separated lines by specific columns

Hello, I have a file which lines' words are comma separated: aa, bb, cc, uu b, ee, ff bb, cc, zz, ee, ss, kk oo, bb, hh, uu a, xx, ww tt, aa, dd, yy aa, gg I want to sort first by second column and in case of tie by fourth column with sort command. So the output would be: ... (4 Replies)
Discussion started by: asanchez
4 Replies

5. Shell Programming and Scripting

Make multiple lines into single quoted comma separated Linux

Hi, I want to change a file file1.txt: 1234 3456 2345 6789 3456 2333 4444 As, file2.txt in Linux: '1234','3456','2345','6789','3456','2333','4444' Could someone please help me. (Single liner sed, awk will be welcome!) (7 Replies)
Discussion started by: wiweq05
7 Replies

6. Shell Programming and Scripting

Combining multiple block of lines in one comma separated line

Hi Everyone, On my Linux box I have a text file having block of few lines and this block lines separated by one blank line. I would like to format and print these lines in such a way that this entire block of lines will come as single comma separated line & again next block of lines in next... (7 Replies)
Discussion started by: gr8_usk
7 Replies

7. UNIX for Dummies Questions & Answers

How to convert a comma delimited string to records or lines of text?

Hi, I am not sure if I've posted this question before. Anyway, I previously asked about converting lines of text into a comma delimited string. Now I am needing to do the other way around ... :( :o Can anyone advise how is this possible? Example as below: Converting records/lines to... (2 Replies)
Discussion started by: newbie_01
2 Replies

8. Shell Programming and Scripting

Comma separated values to individual lines

My OS : RHEL 6.7 I have a text file with comma separated values like below $ cat testString.txt 'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG', . . . . I want these values to appear like below 'JOHN' , 'KEITH' , 'NEWMAN' , 'URSULA' , 'ARIANNA' , 'CHENG', .... (4 Replies)
Discussion started by: kraljic
4 Replies

9. Shell Programming and Scripting

awk to parse comma separated field and removing comma in between number and double quotes

Hi Experts, Please support I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6. ... (3 Replies)
Discussion started by: as7951
3 Replies

10. UNIX for Beginners Questions & Answers

Need help on an old post - How to convert a comma delimited string to records or lines of text?

Hi, Apologies in advance to the moderator if I am posting this the wrong way. I've searched and found the solution to an old post but as it is a very old post, I don't see an option to update it with additional question. The question I have is in relation to the following post: How to... (6 Replies)
Discussion started by: newbie_01
6 Replies
H5TOTXT(1)							      h5utils								H5TOTXT(1)

NAME
h5totxt - generate comma-delimited text from 2d slices of HDF5 files SYNOPSIS
h5totxt [OPTION]... [HDF5FILE]... DESCRIPTION
h5totxt is a utility to generate comma-delimited text (and similar formats) from one-, two-, or more-dimensional slices of numeric datasets in HDF5 files. This way, the data can easily be imported into spreadsheets and similar programs for analysis and visualization. HDF5 is a free, portable binary format and supporting library developed by the National Center for Supercomputing Applications at the Uni- versity of Illinois in Urbana-Champaign. A single h5 file can contain multiple data sets; by default, h5totxt takes the first dataset, but this can be changed via the -d option, or by using the syntax HDF5FILE:DATASET. By default, the entire dataset is dumped to the output. in row-major order. For 3d datasets, this corresponds to a sequence of yz slices, in order of increasing x, separated by blank lines. If -T is specified, outputs in the transposed (column-major) order instead Often, however, you want only a one- or two-dimensional slice of multi-dimensional data. To do this, you specify coordinates in one or more slice dimensions, via the -xyzt options. The most basic usage is something like 'h5totxt foo.h5', which will output comma-delimited text to stdout from the data in foo.h5. OPTIONS
-h Display help on the command-line options and usage. -V Print the version number and copyright info for h5totxt. -v Verbose output. -o file Send text output to file rather than to stdout (the default). -s sep Use the string sep to separate columns of the output rather than a comma (the default). -x ix, -y iy, -z iz, -t it This tells h5totxt to use a particular slice of a multi-dimensional dataset. e.g. -x causes a yz plane (of a 3d dataset) to be used, at an x index of ix (where the indices run from zero to one less than the maximum index in that direction). Here, x/y/z cor- respond to the first/second/third dimensions of the HDF5 dataset. The -t option specifies a slice in the last dimension, whichever that might be. See also the -0 option to shift the origin of the x/y/z slice coordinates to the dataset center. -0 Shift the origin of the x/y/z slice coordinates to the dataset center, so that e.g. -0 -x 0 (or more compactly -0x0) returns the central x plane of the dataset instead of the edge x plane. (-t coordinates are not affected.) -T Transpose the data (interchange the dimension ordering). By default, no transposition is done. -. numdigits Output numdigits digits after the decimal point (defaults to 16). -d name Use dataset name from the input files; otherwise, the first dataset from each file is used. Alternatively, use the syntax HDF5FILE:DATASET, which allows you to specify a different dataset for each file. You can use the h5ls command (included with hdf5) to find the names of datasets within a file. BUGS
Send bug reports to S. G. Johnson, stevenj@alum.mit.edu. AUTHORS
Written by Steven G. Johnson. Copyright (c) 2005 by the Massachusetts Institute of Technology. h5utils March 9, 2002 H5TOTXT(1)
All times are GMT -4. The time now is 07:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy