![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Checking mem usage at specific times in a program | pl4u | UNIX for Advanced & Expert Users | 2 | 04-05-2009 05:26 PM |
| manipulate data with specific format | tonet | Shell Programming and Scripting | 5 | 04-25-2008 11:24 AM |
| Make program only run by root | dave123 | Shell Programming and Scripting | 14 | 03-13-2008 10:59 AM |
| extract specific data from xml format file. | 60doses | Shell Programming and Scripting | 7 | 01-16-2008 03:26 AM |
| How to make a cshell (csh) script interactive | jimmynath | Shell Programming and Scripting | 2 | 09-07-2005 01:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help make a program in cshell that searches and prints in a specific format
say I have a file named phones
in that file every line is like that lastname^firstname^phone how can I make a program in cshell that searches for a specific string in phones and echos the result (if found) like that: lastname1 firstname1 phone1 ------------------ lastname2 firstname2 phone2 and so on.... I only know grep and it prints lastname1^firstname1^phone1 lastname2^firstname2^phone2 ...well thank you anyway ![]() |
|
|||||
|
Quote:
Quote:
|
|
||||
|
#!/bin/bash
i=1 for a in `cat namelist` do echo "Loop$i:" echo "+++++++" grep $a testfile | tr '^' '\n' echo "----------------------------" i=`expr $i + 1` done "namelist" will contain all the names that needs to be searched/formatted. "testfile" is the file name |
|
|||||
|
Quote:
|
![]() |
| Bookmarks |
| Tags |
| cshell, echo, search |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|