Sponsored Content
Top Forums Shell Programming and Scripting How to find the number of column in the text file...? Post 302209529 by psiva_arul on Friday 27th of June 2008 08:11:16 AM
Old 06-27-2008
How to find the number of column in the text file...?

Hi,

i have text file with ~ seperated columns. it is very huge size of file,
in the file sompulsary supposed to has 20 columns with ~ seperated.
so how can i find if the file has 20 column in the all rows...?

Sample file:

APA+VU~10~~~~~03~101~101~~~APA.N O 20081017 120.00 AP~~~USD~US~~~7.650000
APV+JY~10~~~~~03~101~101~~~AAPL.O O 20081017 230.00 AC~~~USD~US~~~3.125000
APV+VL~10~~~~~03~101~101~~~AAPL.O O 20081017 160.00 AP~~~USD~US~~~9.750000
AT000000STR1~08~B28DT41~02~~~05~30~~~~STRV.VI~~~EUR~AT~~~48.990000
AT0000606306~08~B0704T9~02~~~05~30~~~~RIBH.VI S~~~EUR~AT~~~84.580000
AT0000612601~08~B067M97~02~~~05~30~~~~ICEL.VI S~~~EUR~AT~~~31.900000~20~21

Let me know if need more info on this

Regards,
MPSSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to find the average of a given column and also for specified number of rows??

Hi friends I have 100 files in my directory. Each file look like this.. Temp1 Temp2 Temp3 MAS 1 2 3 MAS 4 5 6 MAS 7 8 9 Delhi 10 11 12 Delhi 13 14 15 Delhi 16 17 ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

2. Shell Programming and Scripting

Script to find the average of a given column and also for specified number of rows?

Hi Friends, In continuation to my earlier post https://www.unix.com/shell-programming-scripting/99166-script-find-average-given-column-also-specified-number-rows.html I am extending my problem as follows. Input: Column1 Column2 MAS 1 MAS 4 ... (2 Replies)
Discussion started by: ks_reddy
2 Replies

3. Shell Programming and Scripting

Find duplicates in the first column of text file

Hello, My text file has input of the form abc dft45.xml ert rt653.xml abc ert57.xml I need to write a perl script/shell script to find duplicates in the first column and write it into a text file of the form... abc dft45.xml abc ert57.xml Can some one help me plz? (5 Replies)
Discussion started by: gameboy87
5 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

splitting single column values into text and number component

Hey guys, I have a column that consists of string and integer values without a distinctive deliminator, looking like this... 7ASA 14LAL 245FOO 656MOM 87577DAD ... I want to split the column into two columns, one containing the numbers and one containing the text part. edit: numbers... (3 Replies)
Discussion started by: origamisven
3 Replies

6. Red Hat

How to find a garbage entry in a column wise text file in Linux?

Suppose I have a file containing :- 1 Apple $50 2 Orange $30 3 Banana $10 4 Guava $25 5 Pine@apple $12 6 Strawberry $21 7 Grapes $12 In the 5th row, @ character inserted. I want through sort command or by any other way this row should either on top or bottom. By sort command garbage... (1 Reply)
Discussion started by: Dipankar Mitra
1 Replies

7. Shell Programming and Scripting

Find number of characters in a column and replace

Hi all, I want to count total no. of characters in a column. and if no. of charaters are more than 3 then it must replace it by splitted string. ie, it must place a space after 3 characters. Ex: 21 435g asd3dd jklfjwe wer column number 3 has 4 alphanumeric character, so it must be splitted... (3 Replies)
Discussion started by: CAch
3 Replies

8. Shell Programming and Scripting

How to find the number of occurence of particular word from a text file?

example: i have the following text file... i am very tired. i am busy i am hungry i have to find the number of occurence of a particular word 'am' from the text file.. can any one give the shell script for it (34 Replies)
Discussion started by: sheela
34 Replies

9. Shell Programming and Scripting

awk command to find total number of Special character in a column

How to find total number of special character in a column? I am using awk -f "," '$col_number "*$" {print $col_number}' file.csv|wc -l but its not giving correct output. It's giving output as 1 even though i give no special character? Please use code tags next time for your code and... (4 Replies)
Discussion started by: AjitKumar
4 Replies

10. Shell Programming and Scripting

awk to skip lines find text and add text based on number

I am trying to use awk skip each line with a ## or # and check each line after for STB= and if that value in greater than or = to 0.8, then at the end of line the text "STRAND BIAS" is written in else "GOOD". So in the file of 4 entries attached. awk tried: awk NR > "##"' "#" -F"STB="... (6 Replies)
Discussion started by: cmccabe
6 Replies
TORRUS_SNMPFAILURES(8)						      torrus						    TORRUS_SNMPFAILURES(8)

NAME
snmpfailures - Displays SNMP collector failures. SYNOPSIS
torrus snmpfailures --tree=TREENAME [options...] OPTIONS
--details In addition to failure counters, list the failed SNMP hosts and the time stamps of failure events. --help Displays a help message. DESCRIPTION
This utility prints the SNMP collector failure information in JSON format. Without --details option, it prints only the failure counters. Upon collector startup or after the tree re-compilation, the failure counters are reset to zero. The output is very convenient for further automatic processing in any scripting language. The top level of the output is a JSON object with the following name/value pairs: total_unreachable: NUMBER Displays the number SNMP hosts that are currently unreachable. The number adds up across multiple collector instances for a given tree. If a host becomes reachable again, the number is decreased. total_deleted: NUMBER Displays the number SNMP hosts that are completely removed from SNMP collection for the life cycle of the collector process. This happens when a host is unreachable for too long time and the collector gives up to reach it again. The number adds up across multiple collector instances for a given tree. total_mib_errors: NUMBER Displays the number of MIB errors (noSuchObject, noSuchInstance, and endOfMibView) during the collector life cycle. The number adds up across multiple collector instances for a given tree. detail_unreachable: OBJECT, detail_deleted: OBJECT If the option --details is specified, these objects contain the host names and timestamps of the failures. The keys are contactenations of SNMP host, UDP port, and SNMP community separated by "|". The values are objects representing the UNIX timestamp and a human-readable time string. detail_mib_errors: OBJECT If the option --details is specified, this object displays the MIB error details: for each SNMP host, it lists the datasource leaves which had these errors and the event timestamps. EXAMPLES
The following example illustrates an SNMP host unreachable: torrus failures --tree=main --details { "detail_deleted" : {}, "detail_mib_errors" : {}, "detail_unreachable" : { "217.101.101.101|161|public" : { "time" : "Fri Jul 23 14:15:10 2010", "timestamp" : 1279887310 } }, "total_deleted" : 0, "total_mib_errors" : 0, "total_unreachable" : 1 } The following example illustrates a MIB error: torrus failures --tree=main --details { "detail_deleted" : {}, "detail_mib_errors" : { "217.101.102.102|161|public" : { "count" : 1, "nodes" : { "/Routers/CMTS3/Temperature_Sensors/sensor_01" : { "time" : "Fri Jul 23 15:26:14 2010", "timestamp" : 1279891574 } } } }, "detail_unreachable" : {}, "total_deleted" : 0, "total_mib_errors" : 1, "total_unreachable" : 0 } SEE ALSO
torrus(8), NOTES
See more documentation at Torrus home page: http://torrus.org AUTHOR
Stanislav Sinyagin <ssinyagin@yahoo.com> torrus 2.03 2013-07-26 TORRUS_SNMPFAILURES(8)
All times are GMT -4. The time now is 12:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy