![]() |
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 |
| Multiple file processing - 1st line only to process - search/match substring | toneatlondon | Shell Programming and Scripting | 2 | 01-02-2008 09:20 PM |
| AWK Multi-Line Records Processing | RacerX | Shell Programming and Scripting | 10 | 10-18-2007 08:46 PM |
| processing a file with sed and awk | manouche | Shell Programming and Scripting | 4 | 10-11-2007 04:25 PM |
| Processing a CSV file | janemary.a | High Level Programming | 1 | 05-11-2007 06:27 AM |
| Have a shell script check for a file to exist before processing another file | heprox | Shell Programming and Scripting | 3 | 11-14-2006 03:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi
I amtrying to read the lines from a file, these lines are absolute paths in the system. I want to check if these paths exists, if they doesn't I want to create that path and put a file in that location/path. I had no trouble filtering these paths out using awk, grep, uniq etc but when it comes to write my own lite script that should process these lines I am clueless. I have been reading up awk but it seems a litle complicated, am I gooing in the right direction, what is the easiest way to solve this, what tools should I use? Thanks in advance. Cheers fable00 |
|
||||
|
I just tried this and it seems I have a lead now.
cat /etc/hosts | while q=$(line); do echo $q; done but feel free to give sugestions on how I should handle the logic with checking the if the file structure exists. Cheers fable00 |
|
||||
|
need help in almost a similar case
Hi ,
I am trying to write a script which picks up each entry ( list of Filesystems in a file ) from a file and then checks whether that Filesystem was backed up or not ? # Script to check for the backups of some particular Filesystems backup status cat <one f ile > while q=$(line) do echo $q > FS mminfo -c gbo472b -t yesterday | grep $FS if [ $? -eq 0 ] then echo "$FS was backed up " else echo "$FS was not backed up" fi done but it is not working ..pls let me know the problem. |
|
|||||
|
This script looks like it was written for sh/ksh/bash. If so, the syntax seems to be incorrect.
Code:
#Script to check for the backups of some particular Filesystems backup status ######## cat <one f ile > # hashed this out. you don't need this while read line; do mminfo -c gbo472b -t yesterday | grep $line if [ $? -eq 0 ]; then echo "$FS was backed up " else echo "$FS was not backed up" fi done < /path/to/file/with/filesystem_list |
|
||||
|
Hi ,
Thanks for you reply. But I wanted the script to pick each Filesystem status from the file and see whether it was backed up or not. Looks like the way you are starting the script is wrong. while read line; do mminfo -c <clinet_name> -t yesterday | grep $line My question is with out defining the variable line how can grep understand it. Please reply back.. Thanks |
| Sponsored Links | ||
|
|