Sponsored Content
Top Forums Shell Programming and Scripting Parse a line which has different word length Post 302351442 by cfajohnson on Tuesday 8th of September 2009 02:24:34 PM
Old 09-08-2009

If you are reading the line from a file:

Code:
read var_one var_two < "$file"

If it's already in a variable:

Code:
var="40609 39930"
read var_one var_two <<.
$var
.

Or:

Code:
var_one=${var% *}
var_two=${var#* }

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to parse the given word

Hi , i need to parse the dir /opt/net/Pro/inv/do/disc_001812 to get only dsic001812 . how to do the same using shell script. (2 Replies)
Discussion started by: MuthuAlagappan
2 Replies

2. Shell Programming and Scripting

Perl Parse Word Cksum help

Hi all, I'm attempting to parse through a .bin file word by word and perform a cksum on each word using perl. I'm new to perl so I dont exactly know how to get started. Any help would be greatly appreciated. Thanks! (1 Reply)
Discussion started by: TeamUSA
1 Replies

3. Shell Programming and Scripting

Shell script to parse a line and insert a word

Hi All, I have a file like this, data1,data2,,,data5,data6. i want to write a shell script to replace data3 with "/example/string". which means my data file should look like this . data1,data2,example/string],,data5,data6. Could you guys help me to get a sed command or any other command... (8 Replies)
Discussion started by: girish.raos
8 Replies

4. Shell Programming and Scripting

Print word 1 in line 1 and word 2 in line 2 if it matches a pattern

i have a file in this pattern MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH1 word1 IMAGE word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1 word2 word3 word4 MATCH2 word1... (7 Replies)
Discussion started by: bangaram
7 Replies

5. Shell Programming and Scripting

Parse a String for a Specific Word

Hello, I'm almost there with scripting, and I've looked at a few examples that could help me out here. But I'm still at a lost where to start. I'm looking to parse each line in the log file below and save the output like below. Log File AABBCGCAT022|242|3 AABBCGCAT023|243|4... (6 Replies)
Discussion started by: ravzter
6 Replies

6. Shell Programming and Scripting

Parse variable length status,timestamp CSV

I have the output of a process which on status change of the object being processed appends status,timestamp to the record in the text file... so i end up with output something like: task123,TERMINAL,glob,5,INITIAL,2012-02-27 16:48:07,PREPARING,2012-02-27 16:49:06,SCHEDULED,2012-02-27... (2 Replies)
Discussion started by: KarmaPoliceT2
2 Replies

7. Shell Programming and Scripting

Check for length which exceeds specified length in a line

Hi, I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string. But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields. For ex: Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies

8. Shell Programming and Scripting

Average word length

If i use wc -m filename it will generate the number of characters and wc -w filename will generate number of words if i used this info by dividing number of characters/number of words it will give me misleading result as number of character will include spaces and punctuation as... (3 Replies)
Discussion started by: khaled79
3 Replies

9. 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

10. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies
american-english(5)						   Users' Manual					       american-english(5)

NAME
american-english - a list of English words DESCRIPTION
/usr/share/dict/american-english is an ASCII file which contains an alphabetic list of words, one per line. FILES
There may be any number of word lists in /usr/share/dict/. /etc/dictionaries-common/words is a symbolic link to the currently-chosen /usr/share/dict/<language> file. /usr/share/dict/words is a symbolic link to /etc/dictionaries-common/words, and is the name by which other software should refer to the system word list. See select-default-wordlist(8) for more information, and/or to change the currently- chosen word list. The directory /usr/share/dict can contain word lists for many languages, with name of the language in English, e.g., /usr/share/dict/french and /usr/share/dict/danish contain respectively lists of French and Danish words if they exist. Such lists should be coded using the ISO 8859-1 character set encoding. SEE ALSO
ispell(1), select-default-wordlist(8), and the Filesystem Hierarchy Standard. HISTORY
The words lists are not specific, and may be generated from any number of sources. The system word list used to be /usr/dict/words. For compatibility, software should check that location if /usr/share/dict/words does not exist. AUTHOR
Word lists are collected and maintained by various authors. The Debian English word lists are built from the SCOWL (Spell- Checker Ori- ented Word Lists) package, whose upstream editor is Kevin Atkinson <kevina@users.sourceforge.net>. Debian 16 June 2003 american-english(5)
All times are GMT -4. The time now is 08:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy