Sponsored Content
Top Forums Shell Programming and Scripting Command to get the word from the file Post 302349629 by girish.raos on Tuesday 1st of September 2009 11:36:22 AM
Old 09-01-2009
Command to get the word from the file

Hi All,

I have a file like this,

2.5479E+17 1336877
2.5479E+16 1336977
2.5479E+1789 2446877
....

I want to get this value into two seperate variables. i tried like this,

NOTE: Here the length of this two variables will not be always same.
Code:
profile_poid=`cat temp | cut -d, -f1`
account_poid=`cat temp | cut -d'  ' -f2`

then i get the result like this
Code:
echo $profile_poid = 2.5479E+17 1336877
echo $account_poid =

I want ther result like this
Code:
echo $profile_poid = 2.5479E+17 
echo $account_poid = 1336877

Can anyone please suggest how to do this.

Thanks in advance,
Giri.

Last edited by Yogesh Sawant; 09-01-2009 at 01:21 PM.. Reason: added code tags
 

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. Shell Programming and Scripting

find a word in a file, and change a word beneath it ??

Hi all, I have a file with lines written somewhat like this. aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec (2 Replies)
Discussion started by: vikas027
2 Replies

4. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

5. Shell Programming and Scripting

To read data word by word from given file & storing in variables

File having data in following format : file name : file.txt -------------------- 111111;name1 222222;name2 333333;name3 I want to read this file so that I can split these into two paramaters i.e. 111111 & name1 into two different variables(say value1 & value2). i.e val1=11111 &... (2 Replies)
Discussion started by: sjoshi98
2 Replies

6. UNIX for Advanced & Expert Users

Perl command to replace word in file...

Hi, I want to search for a specific word in file and replace whole line with new text. e.g. 1) I have file with below lines APP=ABCD 12/12/2012 DB=DDB 01/01/2013 I need perl command which will check for APP=$VAL and replace whole line with APP=$NEWVAL $NEWDT Simlarly need a... (2 Replies)
Discussion started by: mgpatil31
2 Replies

7. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

8. Shell Programming and Scripting

Search for a specific word and print only the word from the input file

Hi, I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file. Ex: $ cat "sample.log" I am searching for a word which is present in this file We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

9. UNIX for Beginners Questions & Answers

UNIX script to check word count of each word in file

I am trying to figure out to find word count of each word from my file sample file hi how are you hi are you ok sample out put hi 1 how 1 are 1 you 1 hi 1 are 1 you 1 ok 1 wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies

10. UNIX for Beginners Questions & Answers

Need a command to remove the last word in the first line of a file

I have a eg file op.txt This is a cat This is a fat cat This is a fat black cat I want to remove only the word cat from the first alone .can somebody help. please do wrap your samples in CODE TAGS As per forum rules. (7 Replies)
Discussion started by: Sharks
7 Replies
IO::Socket::UNIX(3pm)					 Perl Programmers Reference Guide				     IO::Socket::UNIX(3pm)

NAME
IO::Socket::UNIX - Object interface for AF_UNIX domain sockets SYNOPSIS
use IO::Socket::UNIX; DESCRIPTION
"IO::Socket::UNIX" provides an object interface to creating and using sockets in the AF_UNIX domain. It is built upon the IO::Socket interface and inherits all the methods defined by IO::Socket. CONSTRUCTOR
new ( [ARGS] ) Creates an "IO::Socket::UNIX" object, which is a reference to a newly created symbol (see the "Symbol" package). "new" optionally takes arguments, these arguments are in key-value pairs. In addition to the key-value pairs accepted by IO::Socket, "IO::Socket::UNIX" provides. Type Type of socket (eg SOCK_STREAM or SOCK_DGRAM) Local Path to local fifo Peer Path to peer fifo Listen Create a listen socket If the constructor is only passed a single argument, it is assumed to be a "Peer" specification. NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE As of VERSION 1.18 all IO::Socket objects have autoflush turned on by default. This was not the case with earlier releases. NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE METHODS
hostpath() Returns the pathname to the fifo at the local end peerpath() Returns the pathanme to the fifo at the peer end SEE ALSO
Socket, IO::Socket AUTHOR
Graham Barr. Currently maintained by the Perl Porters. Please report all bugs to <perlbug@perl.org>. COPYRIGHT
Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 IO::Socket::UNIX(3pm)
All times are GMT -4. The time now is 05:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy