i can't cut the third col


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting i can't cut the third col
# 1  
Old 03-18-2010
i can't cut the third col

Code:
SW_dist_intr    false              Enable SW distribution of interrupts              True
autorestart     true               Automatically REBOOT OS after a crash             True
boottype        disk               N/A                                               False
capacity_inc    1.00               Processor capacity increment                      False
capped          true               Partition is capped                               False
conslogin       enable             System Console Login                              False
cpuguard        enable             CPU Guard                                         True
dedicated       true               Partition is dedicated                            False
ent_capacity    2.00               Entitled processor capacity                       False
frequency       2656000000         System Bus Frequency                              False
fullcore        false              Enable full CORE dump                             True
fwversion       IBM,EL340_061      Firmware version and revision levels              False
id_to_partition 0X80000BAB8FC00001 Partition ID                                      False
id_to_system    0X80000BAB8FC00000 System ID                                         False
iostat          false              Continuously maintain DISK I/O history            True
keylock         normal             State of system keylock at boot time              False
log_pg_dealloc  true               Log predictive memory page deallocation events    True
max_capacity    2.00               Maximum potential processor capacity              False
max_logname     9                  Maximum login name length at boot time            True
maxbuf          20                 Maximum number of pages in block I/O BUFFER CACHE True
maxmbuf         0                  Maximum Kbytes of real memory allowed for MBUFS   True
maxpout         0                  HIGH water mark for pending write I/Os per file   True
maxuproc        2048               Maximum number of PROCESSES allowed per user      True
min_capacity    1.00               Minimum potential processor capacity              False
minpout         0                  LOW water mark for pending write I/Os per file    True
modelname       IBM,8203-E4A       Machine name                                      False
ncargs          128                ARG/ENV list size in 4K byte blocks               True
nfs4_acl_compat secure             NFS4 ACL Compatibility Mode                       True
pre430core      false              Use pre-430 style CORE dump                       True
pre520tune      disable            Pre-520 tuning compatibility mode                 True
realmem         16056320           Amount of usable physical memory in Kbytes        False
rtasversion     1                  Open Firmware RTAS version                        False
sed_config      select             Stack Execution Disable (SED) Mode                True
systemid        IBM,02657AA64      Hardware system identifier                        False
variable_weight 0                  Variable processor capacity weight                False



i have this text and i need the third culmn but i used cut or awk i can't get the third field cause there are spaces in the third field can any one help me
# 2  
Old 03-18-2010
It's a fixed width report, so just cut:
Code:
cut -c36-85

# 3  
Old 03-18-2010
thanks it is work but not logic i can't every time i have text to count no of characters i can't i have like this file about 20 files
plz any one have another idea
# 4  
Old 03-18-2010
Try this ,

Code:
sed -r "s/\s{2,}/|/g" file | cut -d '|' -f 3

# 5  
Old 03-18-2010
Code:
awk '{$1=$2=$NF=""}1' urfile

# 6  
Old 03-18-2010
Quote:
Originally Posted by karthigayan
Try this ,

Code:
sed -r "s/\s{2,}/|/g" file | cut -d '|' -f 3

thanks but not work cause i am in aix

sed: Not a recognized flag: r
Usage: sed [-n] [-u] Script [File ...]
sed [-n] [-u] [-e Script] ... [-f Script_file] ... [File ...]

---------- Post updated at 04:27 AM ---------- Previous update was at 04:25 AM ----------

Quote:
Originally Posted by rdcwayx
Code:
awk '{$1=$2=$NF=""}1' urfile

thanks very much it is work , can u explain it to me to understand what u did ?

i need also the fourth col

THANKS
# 7  
Old 03-18-2010
You can do this if you also need the last column...
Code:
awk '{for(i=3;i<=NF;i++) printf ($i ~ /True|False/?"\t"$i"\n":$i" ")}' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Matrix to 3 col sorted

Hello experts, I have matrices sorted by position, there are 400k rows, 3000 columns. ID CHR POS M1 M2 M3 M4 M5 ID1 1 1 4.6 2.6 2.1 3.5 4.2 ID2 1 100 3.6 2.9 3.2 2.6 2.5 ID3 1 1000 4.1... (9 Replies)
Discussion started by: senhia83
9 Replies

2. Shell Programming and Scripting

Modifying col values based on another col

Hi, Please help with this. I have several excel files (with and .xlsx format) with 10-15 columns each. They all have the same type of data but the columns are not ordered in the same way. Here is a 3 column example. What I want to do add the alphabet from column 2 to column 3, provided... (9 Replies)
Discussion started by: newbie83
9 Replies

3. Shell Programming and Scripting

Printing from col x to end of line, except last col

Hello, I have some tab delimited data and I need to move the last col. I could hard code it, awk '{ print $1,$NF,$2,$3,$4,etc }' infile > outfile but it would be nice to know the syntax to print a range cols. I know in cut you can do, cut -f 1,4-8,11- to print fields 1,... (8 Replies)
Discussion started by: LMHmedchem
8 Replies

4. UNIX for Advanced & Expert Users

Print line based on highest value of col (B) and repetion of values in col (A)

Hello everyone, I am writing a script to process data from the ATP world tour. I have a file which contains: t=540 y=2011 r=1 p=N409 t=540 y=2011 r=2 p=N409 t=540 y=2011 r=3 p=N409 t=540 y=2011 r=4 p=N409 t=520 y=2011 r=1 p=N409 t=520 y=2011 r=2 p=N409 t=520 y=2011 r=3 p=N409 The... (4 Replies)
Discussion started by: imahmoud
4 Replies

5. Shell Programming and Scripting

how to add new col in a file

Hi, Experts, I have a requirement as following: my source file: a a a b b c c c c I need add one more colume as following: 1 a 2 a 3 a 1 b 2 b 1 c 2 c (4 Replies)
Discussion started by: ken002
4 Replies

6. Shell Programming and Scripting

How to Delete the First Blank of the First Col?

Hi to all. In the following example, how can I delete the first blank of the first col? (using shell scripting) first second third fourth fifth sixth seventh eighth Thank's for reading. (5 Replies)
Discussion started by: daniel.gbaena
5 Replies

7. Ubuntu

Match col 1 of File 1 with col 1 File 2 and create a 3rd file

Hello, I have a 1.6 GB file that I would like to modify by matching some ids in col1 with the ids in col 1 of file2.txt and save the results into a 3rd file. For example: File 1 has 1411 rows, I ignore how many columns it has (thousands) File 2 has 311 rows, 1 column Would like to... (7 Replies)
Discussion started by: sogi
7 Replies

8. UNIX for Dummies Questions & Answers

Info about col command

Hello every1. Can any1 help me with the col command. Wat is a reverse line feed. Which kind of files u need to use the col command. (2 Replies)
Discussion started by: rahulrathod
2 Replies

9. UNIX for Advanced & Expert Users

Help On col command

Hello Can Any1 tell me the difference between the col command and the col command with the -f option. I tried running both of them but i can't see any difference. Please guide me. (1 Reply)
Discussion started by: rahulrathod
1 Replies
Login or Register to Ask a Question