Search Results

Search: Posts Made By: krishmaths
1,651
Posted By krishmaths
grep -v "OK" is another option to exclude lines...
grep -v "OK" is another option to exclude lines with string "OK".

In your awk command, try printing entire line instead of just first field using just print or print $0
1,247
Posted By krishmaths
Change your awk to awk...
Change your awk to

awk '{a[NR]=$3;b[NR]=$4;row[NR]=$0} END {for (i in a) printf("%s\t%.3f\n", row[i],(1-(b[i]/(7*24*60*a[i]))))}' infile
2,670
Posted By krishmaths
Or you can modify your awk statement to as below ...
Or you can modify your awk statement to as below

awk '{for(i=2;i<=NF;i++) {if (substr($i,1,1)=="#") next; else print $1,$i}}'
6,338
Posted By krishmaths
shell script
DIR=/your/directory
for FILE in $(ls $DIR)
do
OLD_DT=$(echo ${FILE##*_} | cut -d. -f 1)
NEW_DT=$(expr substr $OLD_DT 5 4)$(expr substr $OLD_DT 1 4)
RENAMED_FILE=$(echo...
7,617
Posted By krishmaths
awk solution (can be made better) awk...
awk solution (can be made better)


awk '{for(i=1;i<=NF;i++) {if($i~/\(/) a=a" "substr($i,1+index($i,"("))} }{gsub(/\)/,"",a);print a;a=""}' infile
10,715
Posted By krishmaths
awk '{sum+=$2;a[++i]=$1} END{for (i in a) {print...
awk '{sum+=$2;a[++i]=$1} END{for (i in a) {print a[i]"/"sum}}' infile
4,559
Posted By krishmaths
You may try the find command find $HOME...
You may try the find command


find $HOME -type f -exec ls -l {} \;


or


ls -ltcR $HOME | awk '/^\// {dir=substr($0,1,length($0)-1)} /^-/{$9=dir"/"$9;print}'
1,101
Posted By krishmaths
x=$(ps -fu myuserid | grep [j]ava | awk '{print...
x=$(ps -fu myuserid | grep [j]ava | awk '{print $2}')
if [ ! -z $x ]
then
echo process is running
else
echo process not running
fi
2,675
Posted By krishmaths
#!/usr/bin/ksh TOTAL_NR_OF_FILES=$(find SMS_*...
#!/usr/bin/ksh
TOTAL_NR_OF_FILES=$(find SMS_* -type f | wc -l)
AVG=$(expr $TOTAL_NR_OF_FILES / 6)

SUFFIX=1
MOVED=0
for FILENAME in $(find SMS_* -type f)
do
if [ $MOVED -eq $AVG ]
then
...
3,342
Posted By krishmaths
Did you try the tr option to remove control...
Did you try the tr option to remove control characters?

tr -d [:cntrl:] <filename >output
1,289
Posted By krishmaths
ls /dev | awk 'match($0,/asm/) {print...
ls /dev | awk 'match($0,/asm/) {print substr($0,RSTART,RLENGTH)}'
Forum: HP-UX 08-29-2013
3,147
Posted By krishmaths
df -k | awk -F":" '/^\//{a=a$1" : ";next} /%/...
df -k | awk -F":" '/^\//{a=a$1" : ";next} /%/ {a=a$1"\n"} END{print a}' | awk '(NF>0){$5=100-$5; $7="free"; $8=""} 1'
2,179
Posted By krishmaths
Hi jiam, 1. Did you receive any error...
Hi jiam,

1. Did you receive any error message?
2. If you had got back to the prompt after the command executed then check if file outfile is created in current directory
2,179
Posted By krishmaths
awk -vf1=outfile '/2351/,/2339/ {$2=0}...
awk -vf1=outfile '/2351/,/2339/ {$2=0} /2338/,/2333/ {$2=1} {a=a$0"\n"} END{print NR>f1; print a>>f1}' infile
12,850
Posted By krishmaths
Assuming you don't have text separated by spaces...
Assuming you don't have text separated by spaces or tabs in a single line

awk '{print $1}' file.xml
17,995
Posted By krishmaths
You need to use awk variable like this: ...
You need to use awk variable like this:


awk -F, -v td=$temp_date '/1,jobname1/ {$3="completed";$5=td} 1' OFS="," file
17,995
Posted By krishmaths
awk -F, 'BEGIN{"date +\"%Y%m%d%H%M%S\""|getline...
awk -F, 'BEGIN{"date +\"%Y%m%d%H%M%S\""|getline d} /1,jobname1/{$3="completed";$5=d} 1' filename
17,995
Posted By krishmaths
awk -F, '/1,jobname1,in_progress/...
awk -F, '/1,jobname1,in_progress/ {$3="completed"} 1' filename
1,225
Posted By krishmaths
awk '{print "t"++i" as filler VARCHAR"}'...
awk '{print "t"++i" as filler VARCHAR"}' extract_file
961
Posted By krishmaths
awk -F":" '{gsub(/,/,"\n"$1":")}1'...
awk -F":" '{gsub(/,/,"\n"$1":")}1' file
2,264
Posted By krishmaths
Could you explain more on what is the issue? What...
Could you explain more on what is the issue? What is the output you are getting?

I see that your input and output are .csv files. Did you copy paste the input data from excel to here?

I used a...
1,165
Posted By krishmaths
When you are on a terminal, just hit \ and enter...
When you are on a terminal, just hit \ and enter to continue command in the next line.

Example:

>echo "Hello \
> World! "
Hello World!
1,037
Posted By krishmaths
You can probably do this if it is okay to create...
You can probably do this if it is okay to create another file and then move it to original file


grep -vf file2 file1 >file3
mv file3 file1
3,127
Posted By krishmaths
I could see a \r carriage return character from...
I could see a \r carriage return character from the data you have posted. Was file2.txt transferred from a windows environment to unix?

If yes, please remove the CRLF (carriage return line feed)...
3,127
Posted By krishmaths
Can you also double check the contents of...
Can you also double check the contents of file2.txt?
Showing results 1 to 25 of 68

 
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy