A record contains 50 fields separated by "~". I need to assign each of these fields to different variables. Following is the shell script approach I tried.
Please share alternate approach to save these variables that might reduce the lines of code.
I'm using these variables further in the script for more operations around them.
suppose i have a file value where it returns 3 values
a=1 b=2 c=4
when i run it.
i am using this file in my shell script. how do i parse and get the value of a b and c? (3 Replies)
I have a file that is large and is broken up by groups of data. I want to take certain fields and display them different to make it easier to read. Given input file below:
2008 fl01 LAC 2589 polk doal
xx 2008q1 mx
sect 25698541
Sales 08 Dept group
lead1 ... (8 Replies)
I have the following script:
#!/usr/bin/perl -w
@files = <*.csv>;
foreach $file (@files) {
open(FH, $file);
my @dt = split(/_|.csv/, $file);
while (<FH>) {
chomp;
print $dt . $dt . ",$_\n";
}
close(FH);
}
This script reads in all csv files in the current directory... (2 Replies)
I would like to parse through some logs looking for things like exception or failed (grep -i failed). Ideal would be if it were in a menu format so someone without unix ability could just choose option 1 2 or 3 etc. If I could pass the hostname to a variable also that would be awesome, so someone... (5 Replies)
I'm programming in csh and I have a text file with hundreds of entries seperated only by spaces. I want to access three fields at a time (as each data set has three components) so that I can send these values to a different routine as three variables until every trio of values in the text file has... (3 Replies)
I am using MKS tool kit on windows server. One config variable is defined in windows environment and I am trying to use that variable.
# Below RootDir is defined in windows
RootDir="\\f01\var"
# in unix script
details="$RootDir/src|$RootDir/tgt"
src=`echo $details|awk -F '|' '{print... (1 Reply)
Hi,
This is my first post here and I am a newbie. :)
I have a file that looks like this :
Introduction:Intro_123.html
Product definition:Prod_def.html
System Setup:SSetup-64bit.html
Setting up user accounts:Set_user_acc.html
I tried to create a script that would output "The filename... (3 Replies)
Hi All,
I have files with a column which has values and ranges, for example
colA colB
ERD1 3456
ERD2
ERD3 4456
I want to have the following output
colA colB colC
ERD1 3456 3456
ERD2 526887 526890
ERD3 4456 4456
Being a newbie to... (2 Replies)
Hello I am trying to develop a shell script that takes a text file such as this...
E-mail@ Soc.Sec.No. *--------Name-----------* Class *School.Curriculum.Major.* Campus.Phone
JCC2380 XXX-XX-XXXX CAREY, JULIE C JR-II BISS CPSC BS INFO TECH 412/779-9445
JAC1936 XXX-XX-XXXX... (7 Replies)
greetings all, I have a task right now that is somewhat stumping me, and I am not sure what the best approach is to take it.
I have a text file that will contain something similar to the following:
first1, other1
first2, other2
first3, other3
first4, other4
I have to generate an... (14 Replies)
Discussion started by: jeffs42885
14 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)