Sponsored Content
Top Forums Shell Programming and Scripting Read line by line not word by word Post 302171959 by ghostdog74 on Saturday 1st of March 2008 10:28:48 AM
Old 03-01-2008
you could just show some sample input files.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

2. UNIX for Dummies Questions & Answers

how to move word by word on command line

Hey All, On commad promt of a shell.. How can we move our cursor word by word. Like Ctrl+A takes to the starting of the command... Any shortcut like that..? Thanks pbsrinivas (1 Reply)
Discussion started by: pbsrinivas
1 Replies

3. UNIX for Dummies Questions & Answers

query on how to search for a line and read 4th word from that line

Assume I have a text file as below: me con pi ind ken pras ur me con rome ind kent pras urs pintu con mys ind pan pras ki con kit ind sys My requirement, I need to search for "con rome" and if exists, then print 4th word from rome, i.e in above example, since "con rome"... (4 Replies)
Discussion started by: jaggesh
4 Replies

4. UNIX for Dummies Questions & Answers

regular expression for replacing the fist word with a last word in line

I have a File with the below contents File1 I have no prior experience in unix. I have just started to work in unix. My experience in unix is 0. My Total It exp is 3 yrs. I need to replace the first word in each line with the last word for example unix have no prior experience in... (2 Replies)
Discussion started by: kri_swami
2 Replies

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

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

7. Shell Programming and Scripting

Read last word of the line.

Hi, I need a script to read last word of the line and out put in some temp file. i it can contain any word like: My name is Harry. or My zip code is 24490 or it can be My secret code is 024H I just need last word of the line (Harry, or 2440 or 024H) Thanks for the posts below.... (10 Replies)
Discussion started by: HarryReid
10 Replies

8. Shell Programming and Scripting

Read line by line and store a word in array

Hi, I would like to read a file line by line and then store the whole line word by word in array so that I can do specific manipulation on each word. $ cat test.txt hello how are you i am good I would like to have an array created dynamically so that first time , the... (4 Replies)
Discussion started by: ashwin3086
4 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
WC(1)								   User Commands							     WC(1)

NAME
wc - print newline, word, and byte counts for each file SYNOPSIS
wc [OPTION]... [FILE]... wc [OPTION]... --files0-from=F DESCRIPTION
Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input. A word is a non-zero-length sequence of characters delimited by white space. The options below may be used to select which counts are printed, always in the following order: newline, word, character, byte, maximum line length. -c, --bytes print the byte counts -m, --chars print the character counts -l, --lines print the newline counts --files0-from=F read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input -L, --max-line-length print the length of the longest line -w, --words print the word counts --help display this help and exit --version output version information and exit GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report wc translation bugs to <http://translationproject.org/team/> AUTHOR
Written by Paul Rubin and David MacKenzie. COPYRIGHT
Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for wc is maintained as a Texinfo manual. If the info and wc programs are properly installed at your site, the com- mand info coreutils 'wc invocation' should give you access to the complete manual. GNU coreutils 8.22 June 2014 WC(1)
All times are GMT -4. The time now is 06:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy