Sponsored Content
Top Forums Shell Programming and Scripting Search name and display column from a file Post 302391277 by sillyha on Sunday 31st of January 2010 07:32:54 PM
Old 01-31-2010
Search name and display column from a file

Hi I have search everywhere for this but I haven't got any result. so here is my question?
I am trying to ask user to enter a name and then searching that name from a file and from a specific column. If user enter something, it should only displaying that name from that specific column and If the user enters quit, then program should quit. I am really having trouble with this. Any help will be appreciate.
Code:
echo "Name:"

while read name
do
        if  [ $name=0 ]
      then
          echo $name < filename
          cut -c 5-19 filename
           #echo "name is $name."
        elif [ $name = "Quit" ]
        then 
     exit       
fi
done


Last edited by Scott; 01-31-2010 at 09:13 PM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help: for display the 1 column from one file?

Hi, boss i have a problem: i want display one column from a file. so i think i can used the awk -F"," '{print $number}' XXXX. but the file contain lots of the column,,,so i can confirm the line number which i need . so can some body help me to solve this issus....... PS: how can i... (5 Replies)
Discussion started by: surainbow
5 Replies

2. Shell Programming and Scripting

Search from file and display

Dear All I had input file as mention below. Now from that file i want to search string "FAULT CODES CLASS" and want to display contain again its. ( ie. 1B4 --4 is in next line. ). Kindly let me know the possible ways. <rxmfp:mo=RXOTX-46-5 ; ... (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

3. Shell Programming and Scripting

Search from file and display

Dear all I had input file as mention below. From that i want op as given below. Kindly let me knw possible ways. Regards Jaydeep CONNECTED bscaaa <rxmfp:mo=RXOTX-46-5 ; RADIO X-CEIVER ADMINISTRATION MANAGED OBJECT FAULT INFORMATION MO BTSSWVER RXOTX-46-5 ERA-G04-R11-V01 ... (5 Replies)
Discussion started by: jaydeep_sadaria
5 Replies

4. Shell Programming and Scripting

Search in file and display

Dear All I had below mention requirement. Kindly sugguest me possible ways. Thanks Regards Jaydeep IN PUT FILE: CELL BROADCAST SHORT MESSAGE SERVICE MESSAGE DATA ID CODE GS UPDATE MODE LANG MCO MCL NUMPAGES 50 1000 0 13 MML 1 1 TEXT PAGE *999*1# SONGS4U@30/M- 1 (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

5. Shell Programming and Scripting

How to display the first column in a file?

Hi I need to dispaly only the first column from f1le1 . But i am unable to do with the cut option . Please help me . The File1 contains the below deatils : 2407765|xyz|774085264795|ABC|2522925531|60.0|01/09/10|CODE1 2408327|xyz|578981547385|ABC|2257881870|60.0|01/09/10| CODE2... (5 Replies)
Discussion started by: isha_1
5 Replies

6. Shell Programming and Scripting

How to search for file and display by date

I like "ls -ltr". I would like to search for a file in a large directory recursively and and display all the candidates in reverse order. /usr/bin/find . -name \*.txt This works. How do I display the date and sort the file names by the date in reverse order for the entire directory... (1 Reply)
Discussion started by: siegfried
1 Replies

7. Shell Programming and Scripting

Search substring in a column of file

Hi all, I have 2 files, the first one containing a list of ids and the second one is a master file. I want to search each id from the first file from the 5th col in the second file. The 5th column in master file has values separated by ';', if not a single value is present. Each id must occur... (2 Replies)
Discussion started by: ritakadm
2 Replies

8. Shell Programming and Scripting

Search first file line after Error and display

I have a log file which contains information like below (more than 200 ERROR sets). Here I want to find first .c file and function after "ERROR: AddressSanitizer" line. If you see here after "ERROR:" line first file - asfrecohandling.c function - ASFPotRecoHandling_Create_RecPaxSrvcComp ... (6 Replies)
Discussion started by: pushpabuzz
6 Replies

9. Shell Programming and Scripting

Search string in multiple files and display column wise

I have 3 files. Each of those files have the same number of records, however certain records have different values. I would like to grep the field in ALL 3 files and display the output with only the differences in column wise and if possible line number File1 Name = Joe Age = 33... (3 Replies)
Discussion started by: sidnow
3 Replies

10. UNIX for Beginners Questions & Answers

UNIX script to compare 3rd column value with first column and display

Hello Team, My source data (INput) is like below EPIC1 router EPIC2 Targetdefinition Exp1 Expres rtr1 Router SQL SrcQual Exp1 Expres rtr1 Router EPIC1 Targetdefinition My output like SQL SrcQual Exp1 Expres Exp1 Expres rtr1 Router rtr1 Router EPIC1 Targetdefinition... (5 Replies)
Discussion started by: sekhar.lsb
5 Replies
IS_UPLOADED_FILE(3)							 1						       IS_UPLOADED_FILE(3)

is_uploaded_file - Tells whether the file was uploaded via HTTP POST

SYNOPSIS
bool is_uploaded_file (string $filename) DESCRIPTION
Returns TRUE if the file named by $filename was uploaded via HTTP POST. This is useful to help ensure that a malicious user hasn't tried to trick the script into working on files upon which it should not be working--for instance, /etc/passwd. This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system. For proper working, the function is_uploaded_file(3) needs an argument like $_FILES['userfile']['tmp_name'], - the name of the uploaded file on the client's machine $_FILES['userfile']['name'] does not work. PARAMETERS
o $filename - The filename being checked. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 is_uploaded_file(3) example <?php if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { echo "File ". $_FILES['userfile']['name'] ." uploaded successfully. "; echo "Displaying contents "; readfile($_FILES['userfile']['tmp_name']); } else { echo "Possible file upload attack: "; echo "filename '". $_FILES['userfile']['tmp_name'] . "'."; } ?> SEE ALSO
move_uploaded_file(3), $_FILES, See Handling file uploads for a simple usage example.. PHP Documentation Group IS_UPLOADED_FILE(3)
All times are GMT -4. The time now is 10:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy