Oh my... ok, let me give it a shot:
The beginning of this line here:
Seems like something's missing there. To me it looks like the end of some global substitution using sed, something like
Furthermore, you don't have any input specified there... Where is the data, that these filters operate on, coming from? A file? Pipe? It's gonna want input from stdin...
if statement needs to be closed with 'fi'.
Now for the filters alone, they don't look extremely difficult to understand.
[CODE]egrep -v '(.sh:|.ksh'[/CODE] is gonna skip lines that contain '.sh:' alebo '.ksh:' The second filter
will erase everything before the last colon, including the colon itself. 'g' at the end is not needed.The third filter:
will erase all characters "^M". (these can be seen as delimiters in some windows files.)
Fourth: will skip (not print for further processing) lines that start with a space or letter 's' present zero or more times and a pound sign. E.g. a line like this:
would be skipped. The line
would not be skipped (there are other chars before pound sign). The line has to contain the pound sign, to be skipped. The next filter
will keep only lines with '.dat' or .ctl, case insensitive (e.g. '.cTl' would be matched)
This long filter:
has four parts: 1. it erases everything before an equal sign, including.
2. changes all commas to spaces
3. changes all semicolons to spaces
4. erases all double quotes.
This filter Will change (translate) all spaces into newlines
This one will erase all spaces (there are none by this time)
This will erase all empty lines.
And finally,
will sort the output lines, printing only the first occurence, if there are multiple same lines; and print only the part of the string after the last slash (-F"/" use slash as delimiter; print $NF, print last field).
The output is gonna be written into file $FILE, which, if exists is gonna get overwritten.
Search for "sed regular expressions" for further explanations.
Ih all,
i have multiples ksh scripts for crontab's unix jobs
they all have same variables declarations and some similar functions
i would have a only single script file to declare my variables, like:
var1= "aaa"
var2= "bbb"
var3= "ccc"
...
function ab { ...}
function bc { ... }... (2 Replies)
I am relatively new to Shell Scripting. I can't understand the following two scripts. Can someone please spare a minute to explain?
1) content s of file a are
(021) 654-1234
sed 's/(//g;s/)//g;s/ /-/g' a
021-654-1234
2)cut -d: -f1,3,7 /etc/passwd |sort -t: +1n gives error (3 Replies)
Hi All;
Is there anybody can explain this script please?
trap 'C_logmsg "F" "CNTL/c OS signal trapped, Script ${G_SCRIPTNAME] terminated"; exit 1' 2
trap 'C_logmsg "F" "Kill Job Event sent from the Console, Script ${G_SCRIPTNAME] terminated"; exit 1' 15 (3 Replies)
Can u please explain what it is doing
#!/bin/sh
fullyear=`/home/local/bin/datemmdd 1`"."`date +%Y`
uehist=/u05/home/celldba/utility/ue/prod/history
echo $fullyear
cd $uehist
ls -ltr pwroutages.master.$fullyear* | awk '{print $9}' > /u01/home/celldba/tmp/pwroutages_master_all_tmp
while... (2 Replies)
#!/usr/bin/perl
use strict;
use warnings;
print "Demo of array slicing \n";
my @abc="a b c d e f g h i j k l m n o p q r s t u v w x y z";
my @a=@abc;
my @random=@abc;
my @comp=@abc;
my @comp1=(@abc,"Hello",@abc);
print "abc is @abc \n";
print "a is @a \n";
print "random is @random \n";... (1 Reply)
Hello world! Can someone please explain me how this code works? I'ts supposed to find words in a dictionary and show the anagrams of the words.
{
part = word2key($1)
data = $1
}
function word2key(word, a, i, x, result)
{
x = split(word, a, "")
asort(a)
... (1 Reply)
Please help me to understand the below 3 lines of code.execute shell in jenkins
1)APP_IP=$( docker inspect --format '{{ .NetworkSettings.Networks.'"$DOCKER_NETWORK_NAME"'.IPAddress }}' ${PROJECT_NAME_KEY}"-CI" )
2)HOST_WORKSPACE=$(echo ${WORKSPACE} | sed... (1 Reply)
#!/bin/awk -f
BEGIN {i=1;file="modified.txt"}
{
if ($0 !~ /^DS:/) {print $0 >> file} else {
if ($0 ~ /^DS:/) {print "DS: ",i >> file;if (i==8) {i=1} else {i++}};
}
}
END {gzip file}
Can someone explain to me how this above script works, I got it from a friend but not able... (3 Replies)