Sponsored Content
Top Forums Shell Programming and Scripting 4 column tsv file, output 1 specific column Post 302257589 by joeyg on Wednesday 12th of November 2008 03:00:40 PM
Old 11-12-2008
Hammer & Screwdriver awk works by default with either tab or space delimiter

So, if your input file was slightly different, you might not get your desired results with a 'plain' awk. See below where there is a single space between the month and a number:

Code:
> cat file66c.tsv
13      Oct 1   Joe     smile
18      Jan 2   Linda   laugh
11      Nov 3   Vets    march

> cat file66c.tsv | tr "\t" "~" | cut -d"~" -f2
Oct 1
Jan 2
Nov 3

> cat file66c.tsv | awk '{print $2}'
Oct
Jan
Nov

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the... (3 Replies)
Discussion started by: patrick87
3 Replies

2. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

I have a text file in the following format: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 13402 NA07019... (3 Replies)
Discussion started by: evelibertine
3 Replies

3. UNIX for Dummies Questions & Answers

Replacing a specific column of a text file with another column

Hi, I have a text file in the following format: Code: 13412 NA06985 0 0 2 46.6432798439 4 4 4 4 13412 NA06991 NA06993 NA06985 2 48.8478948517 4 4 2 4 13412 NA06993 0 0 1 45.8022601455 4 4 2 4 13401 NA06994 0 0 1 48.780669145 4 4 4 4 13401 NA07000 0 0 2 47.7312017846 2 4 4 4 ... (2 Replies)
Discussion started by: evelibertine
2 Replies

4. Shell Programming and Scripting

Replace column that matches specific pattern, with column data from another file

Can anyone please help with this? I have 2 files as given below. If 2nd column of file1 has pattern foo1@a, find the matching 1st column in file2 & replace 2nd column of file1 with file2's value. file1 abc_1 foo1@a .... abc_1 soo2@a ... def_2 soo2@a .... def_2 foo1@a ........ (7 Replies)
Discussion started by: prashali
7 Replies

5. Shell Programming and Scripting

Awk: Need help replacing a specific column in a file by part of a column in another file

Hi, I have two input files as File1 : ABC:client1:project1 XYZ:client2-aa:project2 DEF:client4:proj File2 : client1:W-170:xx client2-aa:WT-04:yy client4:L-005A:zz Also, array of valid values can be hardcoded like Output : ABC:W:project1 XYZ:WT:project2 (1 Reply)
Discussion started by: aa2601
1 Replies

6. Shell Programming and Scripting

Split each column in TSV file to be new line?

My TSV looks like: Hello my name is John \t Hello world \t Have a good day! \t See you later! Is there a simple bash script that splits the tsv on tab to: Hello my name is John Hello world Have a good day! See you later! I'm really stuck, would appreciate any help! (5 Replies)
Discussion started by: pxalpine
5 Replies

7. Shell Programming and Scripting

Converting Single Column into Multiple rows, but with strings to specific tab column

Dear fellows, I need your help. I'm trying to write a script to convert a single column into multiple rows. But it need to recognize the beginning of the string and set it to its specific Column number. Each Line (loop) begins with digit (RANGE). At this moment it's kind of working, but it... (6 Replies)
Discussion started by: AK47
6 Replies

8. Shell Programming and Scripting

Counting specific column and add result in output

Hi all, I have a quick question: I have a 4 column tab-separated file. I want to count the number of times each unique value in column 2 appears and add that number in a 5th column. I have the following input file: waterline-n below-sheath-v 14.8097 A dock-n below-sheath-v ... (4 Replies)
Discussion started by: owwow14
4 Replies

9. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies
LSMBOXRC(5)							File Formats Manual						       LSMBOXRC(5)

NAME
lsmboxrc - configuration file for lsmbox DESCRIPTION
A lsmbox configuration file consists of a list of configuration options and their setting. The hash mark ("#") is used as a "comment" character. Every line beginning with a comment character is ignored. Whitespace is also ignored. COMMANDS
set variable=value Set a configuration variable to the specified value. unset variable Unset a configuration variable. This implies that the built-in default will be used instead. mailboxes filename... Specifies what mailboxes to check. You can have one or several of these lines. Each line can contain the name of one or more mail- boxes, each separated by a space. A filename of ! denotes your inbox. A leading ("=") or ("+") in a filename will be expanded into the path to your mail-directory. CONFIGURATION VARIABLES
folder The path to your mail-directory; this is usually $HOME/Mail/. lsmbox_mail_command Specifies what command to execute when the user selects a mailbox in continuous mode. mark_old Specifies whether or not old unread messages and new messages should be accounted separately. If you explicitly unset this variable using the unset command, the number of new and old messages will be added together as unread messages, otherwise they will be accounted as new and old respectively. mh_seq_unseen Specifies the string used in the .mh_sequences file to list new/old unread messages. If this variable is not set, or explicitly unset, "unseen" will be used. spoolfile The path to where the system keeps your inbox; usually /var/mail/USERNAME or /var/spool/mail/USERNAME. lsmbox_padding The width of the mailbox column. To never add additional padding beyond what's needed to align all values, specify '0' here. COMMENTS
You cannot specify a path or mailbox that contains whitespace characters (space, newline, etc.) Do not bug me about this. Having such filenames/pathnames is stupid anyway. I've deliberately tried to use the same syntax as mutt uses for its configuration-file muttrc whenever possible, to facilitate sourcing of $HOME/.lsmboxrc from your $HOME/.muttrc. lsmbox_mail_command will, however, cause mutt to emit an error. SEE ALSO
lsmbox(1), muttrc(5) HISTORY
Apr 16 2006: Updated for v2.1.0 of lsmbox. Apr 16 2004: Updated for v2.0.0 of lsmbox. Mar 13 2004: Updated for v1.9.0 of lsmbox. Jan 16 2003: Minor fixes. Jan 06 2003: Minor fixes. Dec 09 2002: Minor fixes. Nov 15 2002: Updated for v1.6.0 of lsmbox. Nov 13 2002: Add note about '+' and '='. Nov 06 2002: Minor changes. Nov 04 2002: Minor change. Oct 29 2002: Fixed a typo. Oct 28 2002: Fixed a typo. Oct 26 2002: Updated for v1.1.0 of lsmbox. Oct 26 2002: Updated for v1.0.1 of lsmbox. Oct 21 2002: Initial release. AUTHOR
lsmbox and its manual-pages are written by David Weinehall <tao@acc.umu.se> REPORTING BUGS
Report bugs to <tao@acc.umu.se>. COPYRIGHT
Copyright (C) 2002-2006 David Weinehall This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. David Weinehall Apr 16, 2006 LSMBOXRC(5)
All times are GMT -4. The time now is 01:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy