Read complete line

Thread Tools Search this Thread
# 1  
Read complete line

Hello all,

I have following line and want to search the exact match in text file.

30 6 * * * /data/abc/abc.ksh -f xya.sql -xyz@email -x -c -g

I have tried it many ways like grep -W ,sed,etc.... but could not find the solution.

The above line i am storing it in one variable called "var" and evertime i will have different line in this variable.Can you please help me in this??
# 2  
var='30 6 * * * /data/abc/abc.ksh -f xya.sql -xyz@email -x -c -g'
grep -F -- "$var" file

# 3  
Thanks for your reply But at my end -F is not working.. Smilie

is there any other alternative?
# 4  
Are you using Solaris? Try:
/usr/xpg4/bin/grep -F -- "$var" file

or otherwise try:
fgrep -- "$var" file

# 5  
Thanks a ton!!!!

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove the complete line?

Hello This is my first post in this site I have the next txt file "Employee.txt" with the next data ID Name Department Salary 1 Alejandro IT 1000 2 Alan HR 3000 3 Lupe IT 2500 4 Lili Desing 1500 i... (3 Replies)
Discussion started by: macdroopy
3 Replies

2. Shell Programming and Scripting

Print the complete line based on position as input

Hi , I have a text file like below abcd2223232321212121324343 asdsfffhfgfgfhgfhghghghghghgh dfdfdfgfghfgfgfgfgfgghghghghgh dfdfdfdfdfdfdfdfdfdfdfdfdfdfdfdf 1234567890sasasasfdfbffghffhf abcd222323232121212abcdsds in the above file i need to grep and print the lines if 14th to 18th... (4 Replies)
Discussion started by: aravindj80
4 Replies

3. Programming

How can I read complete word from text file?

how can I know that the word in test file end at this point .... I have an Idea to search on ' ' , '\n' or '\0' but don't know what function can store the string before those characters .. help please ! (3 Replies)
Discussion started by: fwrlfo
3 Replies

4. UNIX for Dummies Questions & Answers

Can grep command return word instead of complete line

Hi Is there any way GREP command can return word and not complete line. My file has following data: Hello Everyone I am NitinrajSrivastava Hi Friends Welcome VrajSrivastava I am using grep 'raj' which is returning me complete line.However I want only the word having keyword 'raj'. Required... (11 Replies)
Discussion started by: dashing201
11 Replies

5. Shell Programming and Scripting

bash: read file line by line (lines have '\0') - not full line has read???

I am using the while-loop to read a file. The file has lines with null-terminated strings (words, actually.) What I have by that reading - just a first word up to '\0'! I need to have whole string up to 'new line' - (LF, 10#10, 16#A) What I am doing wrong? #make file 'grb' with... (6 Replies)
Discussion started by: alex_5161
6 Replies

6. Shell Programming and Scripting

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... (8 Replies)
Discussion started by: gupt_ash
8 Replies

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

8. UNIX for Advanced & Expert Users

Delete a word and complete line

Hi Canone please provide me solution how can achieve the result below: File1.txt $ sweet apple£1 scotish green $ This is a test1 $ sweet mango£2 asia yellow $ This is a test 2 $ sweet apple red (there is no pound symbol here) germany green (1 Reply)
Discussion started by: Aejaz
1 Replies

9. UNIX for Dummies Questions & Answers

Using the Esc key to complete command line typing

Dear Techs, In the past on a different box (HP) I use to be able to complete something I was typing by entering a portion of the filename in the pwd and I would hit the Esc key and it would match the rest of the filename. I did this without understanding how it was setup. Now I am on a new... (1 Reply)
Discussion started by: jxh461
1 Replies

10. UNIX for Advanced & Expert Users

ls -R command but need complete path name on each line

Can anyone help me with the following: I need to traverse subdirectories to create a list of files with the pathname. For example, here’s what I get with a simple ls –alR command: /MAIN/data/30007390 dte2>>ls -alR .: total 2 drwxrwx--- 4 ecfadmin staff 96 Oct 24 18:35 . ... (2 Replies)
Discussion started by: condor4-2
2 Replies

Featured Tech Videos