Sponsored Content
Top Forums Shell Programming and Scripting Reading first column of file which start with space also Post 302838155 by diehard on Monday 29th of July 2013 04:46:23 AM
Old 07-29-2013
Reading first column of file which start with space also

Hi All,

I am trying to read first column of my file using command
Code:
cat temp2_sample.cir|cut -d' ' -f1

The content of my file is as follow
Code:
          R1    pin23I    pin27I
R2    pin23G    pin27G
R3    pin27F    pin27D
    RWire10    pin15Y    pin23J
VCC1    pin27W    pin13Y
                                      RWire21    pin28W    pin27B

Here I am getting output as
Code:
R1
R2
R3
RWire10
VCC1

I am not getting RWire21 in my output. Initially I thought it could be due to more space but if that is the case then R1 and RWire10 should also be not printed.
Please advise me where I can do changes in my command.
Thanks and Regards

---------- Post updated at 03:46 AM ---------- Previous update was at 03:44 AM ----------

Please consider space before R1 and both RWire. It is not showing in forum.

Moderator's Comments:
Mod Comment Use code tags please, see PM.

Last edited by zaxxon; 07-29-2013 at 06:04 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL: reading 2 column data into Hash file

I am trying to read in a 2 column data file into Perl Hash array index. Here is my code. #!/usr/bin/perl -w use strict; use warnings; my $file = "file_a"; my @line = (); my $index = 0; my %ind_file = (); open(FILE, $file) or die($!); while(<FILE>) { chomp($_); if ($_ eq '') { ... (1 Reply)
Discussion started by: subhap
1 Replies

2. Shell Programming and Scripting

Reading a column from xls file using perl

Hi Everyone! I have a problem in reading a specific column from .xls file using perl language and then manipulating on given criteria. Detailed Description of the problem:: I have one .xls file, in which i have to populate two columns based on Period_date column which is in same file. My... (1 Reply)
Discussion started by: kvth
1 Replies

3. Shell Programming and Scripting

How to avoid the truncating of multiple spaces into a single space while reading a line from a file?

consider the small piece of code while read line do echo $line done < example content of example file sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr the output is like sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr the... (4 Replies)
Discussion started by: Kesavan
4 Replies

4. UNIX for Dummies Questions & Answers

How do you delete cells from a space delimited text file given row and column number?

How do you delete cells from a space delimited text file given row and column number? Letś say the row number is r and the column number is c. Thanks! (5 Replies)
Discussion started by: evelibertine
5 Replies

5. Shell Programming and Scripting

How to start reading from the nth line till the last line of a file.

Hi, For my reuirement, I have to read a file from the 2nd line till the last line<EOF>. Say, I have a file as test.txt, which as a header record in the first line followed by records in rest of the lines. for i in `cat test.txt` { echo $i } While doing the above loop, I have read... (5 Replies)
Discussion started by: machomaddy
5 Replies

6. UNIX for Dummies Questions & Answers

Adding tags to a specific column of a space delimited text file

I have a space delimited text file with two columns. I would like to add NA to the first column of the text file. Input: 19625 10.4791768259 19700 10.8146489183 19701 10.9084026759 19702 10.9861346978 19703 10.9304364984 Output: NA19625 10.4791768259 NA19700 10.8146489183... (1 Reply)
Discussion started by: evelibertine
1 Replies

7. UNIX for Dummies Questions & Answers

Extracting rows from a space delimited text file based on the values of a column

I have a space delimited text file. I want to extract rows where the third column has 0 as a value and write those rows into a new space delimited text file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

8. Shell Programming and Scripting

Reading columns from a text file and to make an array for each column

Hi, I am not so familiar with bash scripting and would appreciate your help here. I have a text file 'input.txt' like this: 2 3 4 5 6 7 8 9 10 I want to store each column in an array like this a ={2 5 8}, b={3 6 9}, c={4 7 10} so that i can access any element, e.g b=6 for the later use. (1 Reply)
Discussion started by: Asif Siddique
1 Replies

9. Shell Programming and Scripting

Reading line by line from live log file using while loop and considering only those lines start from

Hi, I want to read a live log file line by line and considering those line which start from time stamp; Below code I am using, which read line but throws an exception when comparing line that does not contain error code tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies

10. Shell Programming and Scripting

Reading the value of particular column from csv file

Hi Folks, I have the below csv file which is comma delimited , now from this file i need to read the value of the column der_id and then want to create a separate text file which will contain the value of the column der_id only please advise how to read the value of the column der_id and then... (3 Replies)
Discussion started by: punpun66
3 Replies
FIAIF-UPDATE(8) 				      Administration and Privileged Commands					   FIAIF-UPDATE(8)

NAME
fiaif-update - tests for new version and updated reserved_networks file. SYNOPSIS
fiaif-update [--silent] [--help] <update|check> DESCRIPTION
Tests for new version and updated reserved_networks file. --silent If this flag is present, then no textual output will be given. check Test if a new version of FIAIF is available. update Retrieves the files reserved_networks from the FIAIF website, and compared the version with the currently installed version, as pointed to by fiaif.conf. If the retrieved version is newer, the old version is silently replaced. help Prints the synopsis. EXIT CODE
If updating the exit code will be non-zero if no update was performed, else the exit code will be zero. FILES
/etc/fiaif/fiaif.conf The configuration file for FIAIF /etc/fiaif/private_networks A list of private networks as specified by RFC1918 /etc/fiaif/reserved_networks A list of reserved networks as specified by IANA. REPORTING BUGS
Report bugs to <fiaif@fiaif.net>. AUTHOR
Anders Fugmann <anders(at)fugmann.net> SEE ALSO
fiaif(8), fiaif.conf(5) Linux Feb 2003 FIAIF-UPDATE(8)
All times are GMT -4. The time now is 02:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy