Sponsored Content
Top Forums Shell Programming and Scripting Reading complete line after spaces Post 302375011 by gupt_ash on Thursday 26th of November 2009 06:42:19 AM
Old 11-26-2009
Reading complete line after spaces

Hi,

I am reading data from a variable which has spaces in it. I want to get the data after first space, i.e. if my data line is "My Name is Ashish...", I want the data returned as "Name is Ashish". I am using #!/bin/sh shell. Please help me with the code to read the complete data after first space.

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

prob with spaces in reading a file

i have a file in unix having data like cat dog (having spaces in the beginning) when i read it in a shell script cat file_name |while read line do echo $line done it will print cat dog spaces at the beginning are removed.... i dont want these spaces to be... (2 Replies)
Discussion started by: Amardeep
2 Replies

2. UNIX for Dummies Questions & Answers

Reading a line including spaces

Hi All, I have a script that reads a file and echo it back to std out. Test.txt 1aaaaaaaaaaa . The script is ReadLine.sh #!/bin/ksh cat $1 | while read file do echo $file done I invoke the script as ReadLine.sh Test.txt The output that I get is (1 Reply)
Discussion started by: aksarben
1 Replies

3. Shell Programming and Scripting

Reading a file using sh with spaces in filename

Hi I am trouble parsing through a file with spaces in the filename. I need to grab "supportIDPS/SCM/windows_install/file groups/dds.fgl" and then do a md5sum on it. I am using sh. Any help is appreciated. Here is an example of the input file: 7eedbc9f7902bf4c1878d9e571addf9a ... (4 Replies)
Discussion started by: jekl5
4 Replies

4. UNIX for Dummies Questions & Answers

how to append spaces(say 10 spaces) at the end of each line based on the length of th

Hi, I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is. I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies

5. Shell Programming and Scripting

Split a line on positions before reading complete line

Hi, I want to split before reading the complete line as the line is very big and its throwing out of memory. can you suggest. when i say #cat $inputFile | while read eachLine and use the eachLine to split its throwing out of memory as the line size is more than 10000000 characters. Can you... (1 Reply)
Discussion started by: vijaykrc
1 Replies

6. Shell Programming and Scripting

reading in arguments with spaces

I want to be able to read in input which contain spaces and put that into an array. Each field should be delimeted by a space and should be a different array element. However I cant get it to work. any tips? read input //type field1 field2 field3 echo "$input" array="$input" Thanks in... (11 Replies)
Discussion started by: Calypso
11 Replies

7. Shell Programming and Scripting

How to avoid the truncating of multiple spaces into a single space while reading a line from a file?

consider the small piece of code while read line do echo $line done < example content of example file sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr the output is like sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr the... (4 Replies)
Discussion started by: Kesavan
4 Replies

8. Shell Programming and Scripting

Reading in data that has spaces in it.

I have a csv file called template.csv which has the following data Name, Age, Height Jessica Jesse, 18, 150 Now what I want to do is use a shell script to read the name age and height which looks like this: #!bin/sh INPUT='template.csv while read Name Age Height do echo... (2 Replies)
Discussion started by: JSNY
2 Replies

9. UNIX for Dummies Questions & Answers

Reading filenames with spaces

Hello I've got a certain no. of files in a directory whose names I'm reading and redirecting into a temporary text file using the command below: ls -l | grep ^- | awk '{print $9}'However, whenever the file names contain spaces the above command considers only the part of the file name up to... (5 Replies)
Discussion started by: S. BASU
5 Replies

10. Shell Programming and Scripting

Help with reading directory paths with spaces from a file

Hi I want to know how to handle the spaces in the below scenario. I have a file (CON_zip_path_1.txt) which has some directory paths with spaces in directory names . My requirement is to unzip these zip files to another path. Please see the code below and the error. CON_zip_path_1.txt... (4 Replies)
Discussion started by: paul1234
4 Replies
FETCH(9)						   BSD Kernel Developer's Manual						  FETCH(9)

NAME
fetch, fubyte, fuswintr, fuword, fuword16, fuword32, fuword64, fueword, fueword32, fueword64 -- fetch data from user-space SYNOPSIS
#include <sys/types.h> #include <sys/systm.h> int fubyte(volatile const void *base); long fuword(volatile const void *base); int fuword16(volatile const void *base); int32_t fuword32(volatile const void *base); int64_t fuword64(volatile const void *base); long fueword(volatile const void *base, long *val); int32_t fueword32(volatile const void *base, int32_t *val); int64_t fueword64(volatile const void *base, int64_t *val); #include <sys/resourcevar.h> int fuswintr(void *base); DESCRIPTION
The fetch functions are designed to copy small amounts of data from user-space of the current process. If read is successful, it is per- formed atomically. The data read must be naturally aligned. The fetch routines provide the following functionality: fubyte() Fetches a byte of data from the user-space address base. The byte read is zero-extended into the results variable. fuword() Fetches a word of data (long) from the user-space address base. fuword16() Fetches 16 bits of data from the user-space address base. The half-word read is zero-extended into the results variable. fuword32() Fetches 32 bits of data from the user-space address base. fuword64() Fetches 64 bits of data from the user-space address base. fuswintr() Fetches a short word of data from the user-space address base. This function is safe to call during an interrupt context. fueword() Fetches a word of data (long) from the user-space address base and stores the result in the variable pointed by val. fueword32() Fetches 32 bits of data from the user-space address base and stores the result in the variable pointed by val. fueword64() Fetches 64 bits of data from the user-space address base and stores the result in the variable pointed by val. The callers of fuword(), fuword32() and fuword64() functions cannot distinguish between -1 read from userspace and function failure. RETURN VALUES
The fubyte(), fuword(), fuword16(), fuword32(), fuword64(), and fuswintr() functions return the data fetched or -1 on failure. The fueword(), fueword32() and fueword64() functions return 0 on success and -1 on failure. SEE ALSO
copy(9), store(9) BSD
October 29, 2014 BSD
All times are GMT -4. The time now is 10:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy