I gang

UNIX Scripts

4 Scipts

SCRIPT 1

# Purpose: This script prints out file sizes as either small, medium or

# large.

# Input: File Name(required)

# Procedure: 1 - Check that the fileName is entered. If not 1 parameter,

# print an error and exit.

# 2 - Check that the file exist. If not, print a message and

# exit.

# 3 - Do an "ls" and pipe the output to cut. Cut the columns

# that contain the size and save them to a variable.

# 4 - Branch on the size:

# 1 - if 1000 but 100000 print ${filename} is large

# Useage: fileSize file

SCRIPT 2

#!/bin/ksh

# Copyright 2004: All rights Reserved.

#

# Purpose: This script kills a process by the name of the command it is

running.

# Input: Command Name

# Procedure: 1 - Check that the commandName is entered. If not 1 parameter,

# print an error and exit.

# 2 - Do a ps and pipe the output to grep looking for the commandName.

# Send the output from grep to "/dev/null"

# 3 - Check the return code from grep. If commandName not found,

# print a message and exit.

# 4 - Run a "kill -15" on the results of a subshell that does

# a "ps" sending the output to grep, and then using cut to

# get the process id.

# Useage: pskill vi

SCRIPT 3

#

# Purpose: This script finds all files that contain the given string in this

# directory and all sub-directories.

# Input: string - the string to find

# Procedure: 1 - Check that the string is entered. If not 1 parameter,

# print an error and exit.

# 2 - Find all files in all subdirectories that are not directories

# themselves. (Or you can just find all files that are

# regular files). Save them in a variable.

# 3 - Do an iteration over all the files from step 2.

# 1 - grep in the file for the string, sending the output

# to /dev/null.

# 2 - Check the return code from grep. If the return code

# says the string was found, print out the file name.

# Useage: findInFiles string

#

SCRIPT 4

# script: findBadNames

# Purpose: This script finds all files in all subdirectories that do not

# have a specified string in their name.

# Input: String (required) - The string that must be in every file name.

# Note that the string is case insensitive, it can be either

# caps or lower case in the program name.

# Directory - The directory to look in. Default is "."

# Procedure: 1 - Check that the String and Directory have been entered.

# If just the string, set the default directory to ".".

# Otherwise print an error and exit.

# 2 - Do a find from the entered directory and write all

# the found files to a temporary file.

# 3 - grep for the string in the file of file names (make sure

# to use options for grep to make it case insensitive). Send

# the output to a temp file.

# 4 - Do a diff on the two temp files. The difference is the invalid

# file names.

# 5 - Clean up your temp files.

# Useage: findBadNames string [directory]

#

Færdigheder: System Administrator

Se mere: up string, find unix, all sub, vi, unix admin, says, ps, prints, pipe, null, medium, exit, pipe error, string find, running error, error sending, save file directory, temporary, using scripts, string contain, find files directory, running unix, iteration, bin file, filesize

Om arbejdsgiveren:
( 0 bedømmelser ) Washington, United States

Projekt-ID: #79302

Tildelt til:

rodrigogonzalez

Please check PMB

$75 USD på 1 dag
(25 bedømmelser)
4.7

3 freelancere byder i gennemsnit $72 for dette job

Aserdp

I have been a system admin for the last 8 years and can easily write the scripts for you.

$40 USD in 2 dage
(17 bedømmelser)
3.8
fountaintechies

Hello, Our team would be happy to work on a proper developement of the given script. Would you like us to use perl or shell scripting. Our system admin's can do it in 5 days max. Thanks.

$100 USD in 5 dage
(0 bedømmelser)
2.0