Sponsored Content
Top Forums Shell Programming and Scripting Can a shell script pull the first word (or nth word) off each line of a text file? Post 302085393 by tricky on Thursday 17th of August 2006 03:51:45 AM
Old 08-17-2006
Hammer & Screwdriver Reading word number x of line y in a script of a file of z lines

I'll give that thought a try and post the complete script.....
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read last word of nth line

Hi people; i want to read the last word of the 14th line of my file1.txt. Here is the EXACT 14th line of the file. 250 SectorPortnum=3,AuxPortInUngo=2,PortDeviceGroup=1,PortDeviceSet=1,PorDevice=1 20 >>> Set. i have to get the word Set. how can i call it and also how... (3 Replies)
Discussion started by: gc_sw
3 Replies

2. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

3. Shell Programming and Scripting

how to find third(nth) word in all line from a file

For example i'm having the below contents in a file: expr is great when you want to split a string into just two parts. The .* also makes expr good for skipping a variable number of words when you don't know how many words a string will have. But expr is lousy for getting, say, the fourth word... (2 Replies)
Discussion started by: bangarukannan
2 Replies

4. Shell Programming and Scripting

Reading a word from a text file into shell script

Hi, I am new to shell programming.I need to write a script that would accept a word from each line fo an input text file.Can anyone help me with this?Exact requirement: word1 word2 word3 (separated by space) .Now I need word3 from each such line in the text file. Thanks in Advance, Manish (3 Replies)
Discussion started by: manish007
3 Replies

5. Shell Programming and Scripting

How to read nth word from delimited text file?

Hi i am new in scripting how i can get 2 elements from first line of delimited txt file in shell scripts. AA~101010~0~AB~8000~ABC0~ BB~101011~0~BC~8000~ABC~ CC~101012~0~CD~8000~ABC0~ DD~101013~0~AB~8000~ABC~ AA~101014~0~BC~8000~ABC0~ CC~101015~0~CD~8000~ABC~ can anyone plse help?... (3 Replies)
Discussion started by: sushine11
3 Replies

6. Shell Programming and Scripting

Search for the word and exporting 35 characters after that word using shell script?

I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word description excluding weird characters like $$#$#@$#@***$# and without html tags in the new file output.txt. Help me. Thanx in advance. My final goal is to... (11 Replies)
Discussion started by: sachit adhikari
11 Replies

7. Shell Programming and Scripting

Search for the word and exporting 35 characters after that word using shell script

I have a file input.txt which have loads of weird characters, html tags and useful materials. I want to display 35 characters after the word "description" excluding weird characters like $&lmp and without html tags in the new file output.txt. Help me. Thanx in advance. I have attached the input... (4 Replies)
Discussion started by: sachit adhikari
4 Replies

8. Shell Programming and Scripting

Get the nth word of mth line in a file

Hi.. May be a simple question but I just began to write unix scripts a week ago, for sorting some huge amount of experiment data, so I got no common sense about unix scripting and really need your helps... The situation is, I want to read the nth word of mth line in a file, and then store it... (3 Replies)
Discussion started by: freezelty
3 Replies

9. Shell Programming and Scripting

How to grep nth word in line?

my input file content is like this GEFITINIB 403 14 -4.786873 -4.786873 -1.990111 0.000000 0.000000 -1.146266 -39.955912 483 VANDETANIB 404 21 -4.754243 -4.754243 -2.554131 -0.090303 0.000000 -0.244210 -41.615502 193 VANDETANIB 405 21 -4.737541 -4.737541 -2.670195 -0.006006 0.000000 -0.285579... (4 Replies)
Discussion started by: chandu87
4 Replies

10. Shell Programming and Scripting

Read a File line by line and split into array word by word

Hi All, Hope you guys had a wonderful weekend I have a scenario where in which I have to read a file line by line and check for few words before redirecting to a file I have searched the forum but,either those answers dint work (perhaps because of my wrong under standing of how IFS... (6 Replies)
Discussion started by: Kingcobra
6 Replies
whom(1) 						      General Commands Manual							   whom(1)

NAME
whom - report to whom a message is addressed (only available within the message handling system, mh) SYNOPSIS
whom [options] [file] OPTIONS
Specifies the alias file to be consulted by whom. If you have used one or more aliases in your message header, whom will consult the named file to find those aliases, and will print the full addresses as its output. You can reference more than one file, but each file name must be preceded by the word -alias. See mh-alias(4) for more information. Checks that the addresses are valid. whom makes no guarantees that the addresses listed as being correct are really deliverable: rather, an address being listed as correct means that at the time that whom was run, the address was thought to be deliverable by the transport service. For local addresses, this means that the local user does exist, and that the address was deliverable at the time of checking. For network and uucp addresses, it means that the syntax of the address is valid. Sets the draft message to be the standard file draft in your Mail directory. Specifies the folder in which whom searches for the draft message. The default is to use the current message in the named folder. You can select another message by using the -draftmessage option. For more information on using a draft folder, see comp(1). The -draftfolder option is often set up in your user pro- file; see mh_profile(4) for more information. Specifies the draft message to be used. If you specify a folder with the -draftfolder option, the -draftmessage option takes the number of a message in that folder. If you do not specify a folder, -draftmessage takes the name of a file. If you do not give an absolute pathname (one beginning with a / or or ), -draftmessage assumes that the file is located in your Mail directory. Prints a list of the valid options to this command. Specifies the format of the addresses to be checked. The only value allowed is smtp, which checks that addresses are deliverable over the standard mail system. Additional values are supported only for use with other mail systems. The defaults for this command are: file defaults to <mh-dir>/draft -nocheck -alias /usr/lib/mh/MailAliases -mts smtp DESCRIPTION
The whom command is used to expand the headers of a message into a set of addresses, and optionally to verify that those addresses are deliverable at that time if -check is given. The whom command is often invoked as one of the options offered by the whatnow program when you have finished editing a draft message. See whatnow(1) for more details. If you want to run whom on a named file, you can supply a file argument. This argument allows you to specify a named file; if you want to run whom on an existing message, use the -draftfolder and -draftmessage options. If you do not give an absolute pathname (one beginning with a / or or ), whom assumes that the named file is in your current working directory. RESTRICTIONS
For this version, the -mts option only supports the value smtp. Additional values are supported for use only with other mail systems. PROFILE COMPONENTS
Path: To determine your MH directory (mh-dir) Draft-Folder: To find the default draft-folder postproc: Program to post the message EXAMPLES
In the following example, whom would use the current message in the +drafts folder: % whom -draftfolder +drafts smith: address OK In the next example, whom searches for message 2 in the folder +drafts: % whom -draftfolder +drafts -draftmessage 2 davis@hostname: address OK FILES
The user profile. SEE ALSO
comp(1), mh-alias(4), post(8) whom(1)
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy