#!/bin/bash
clear
echo "Please enter the date for CD info wanted: \c"
read rrd_date
echo "Please enter CEC CEM or CEP: \c"
read file_name
sleep 2
# Create the output file with CEC CEP or CEM information
echo "Creating $file_name file"
cd /opt/cdunix/work/vcndm
sleep 2
grep $file_name S2*$rrd_date.* >~/rrd$rrd_date$file_name
echo "output rrd$rrd_date$file_name file created"
sleep 2
FILE=~/rrd$rrd_date$file_name
echo $FILE
FS="|"
while read line
do
# store field 1
F1=$(echo $line | cut -d$FS -f1)
echo "$F1" >>~/cdrrdout$rrd_date$file_name
# store field 2
F2=$(echo $line | cut -d$FS -f2)
echo "$F2" >>~/cdrrdout$rrd_date$file_name
# store field 18
F18=$(echo $line | cut -d$FS -f18)
echo "$F18" >>~/cdrrdout$rrd_date$file_name
# store field 19
F19=$(echo $line | cut -d$FS -f19)
echo "$F19" >>~/cdrrdout$rrd_date$file_name
echo " " >>~/cdrrdout$rrd_date$file_name
done < $FILE
echo "cdrrdout$rrd_date$file_name has been created"
This part works... just not sure how to incorporate if the file was archived (zipped) into this process.
Thanks!
---------- Post updated at 08:49 AM ---------- Previous update was at 08:47 AM ----------
Connect Direct/NDM file transmissions
Next time use CODE-tags when posting code, data or logs to enhance readability and to preserve foramtting like indention etc., ty.
---------- Post updated at 09:40 AM ---------- Previous update was at 08:49 AM ----------
was also wondering if egrep would be better to use instead of grep when looking at the file?
Last edited by zaxxon; 07-24-2009 at 10:58 AM..
Reason: daily CODE tags
We have a scripting requirement,
Background:
On a particular path, we compress a load of log files into tar.gz.
This is done on an hourly basis throughout the day and it produces files of the following format,
2005-08-05-00-021031.tar.gz as an example. This is done by a script.
We need:
... (2 Replies)
can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files...
pls someone help me on this...
thanking in anticipation.... (1 Reply)
in unix bc command is used as calculator and also for conversion, i want to convert 5f to decimal. but bc dont consider 5f as hex value it considers 5F as hex value. I get 5f from other iteration so i cant change that f to F...is there any way to convert 5f to decimal ot 5f to 5F :rolleyes: (2 Replies)
Hello all.
Like Ive stated before, I am new to world of Unix. I was given the tast to create a script that will concatenate 20 files into one file. I know that the cat command is to be used but I am looking for something to get started on. Again, basically I need to wrtie a script that whill... (3 Replies)
Hi
How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Hi all,
I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first.
Can you please help me determine which one to... (14 Replies)
I just upgraded to Android 2.2 from 2.1. The GPS issue that was troublesome in 2.1 seems to have been fixed. Some of web browsing seems faster, but it could just be my connection is better today ;) Flash works in some browsers but not very good and it is too slow for Flash apps designed for... (0 Replies)
Gents,
I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies
LEARN ABOUT OPENSOLARIS
echo
echo(1B) SunOS/BSD Compatibility Package Commands echo(1B)NAME
echo - echo arguments to standard output
SYNOPSIS
/usr/ucb/echo [-n] [argument]
DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output.
echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi-
ronment variables.
For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows:
o echo your current-working-directory's full pathname
o pipe the output through tr to translate the path's embedded slash-characters into space-characters
o pipe that output through wc -w for a count of the names in your path.
example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w"
See tr(1) and wc(1) for their functionality.
The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if
the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape
characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's
echo() also understands a as the audible bell character; however, these commands do not have an -n option.
OPTIONS -n Do not add the NEWLINE to the output.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5)NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases.
SunOS 5.11 3 Aug 1994 echo(1B)