Quantcast
Channel: UNIX and Linux Forums
Viewing all 16232 articles
Browse latest View live

Bash to match and store line as variable

$
0
0
The bash below loops through a specific directory dir and finds and writes the oldest folder to a variable called $filename.

Code:

#!/bin/bash

# oldest folder stored as variable for analysis, version log created, and quality indicators matched to run
dir=/home/cmccabe/Desktop/NGS/test

find "$dir" -maxdepth 1 -mindepth 1 -type d -printf '%T+\t%P\0' | sort -rz |
while read -r -d $'\t' time && read -r -d '' filename
do
    printf "The oldest folder is $filename, created on $time and analysis done using v1.4 by $USER at $(date "+%D %r")\n" >> /home/cmccabe/medex.logs/folder.log
    awk -v FL="$filename" '
        FNR == 1 {filenum++}
        filenum==1 && index($0, FL) {
              match($0, "_0*([0-9]+)/")
              FNUM=substr($0,RSTART+1,RLENGTH-2)
              gsub(/^0+/,"", FNUM)
          }
          filenum==2 && $0 ~ FNUM".pdf$"' /home/cmccabe/s5_files/downloads/list /home/cmccabe/s5_files/pdf/pdf > /home/cmccabe/s5_files/pdf/output
    break
done

Result output stored in /home/cmccabe/medex.logs/folder.log
Code:

The oldest folder is R_2017_01_13_12_11_56_user_S5-00580-24-Medexome, created on 2017-01-17+11:31:02.5035483130 and analysis done using v1.4 by cmccabe at 01/17/17 12:41:03 PM
The variable (in bold) is also written to a log file stored at/home/cmccabe/medex.logs/folder.log.

So the R_2017_01_13_12_11_56_user_S5-00580-24-Medexome would be extracted and saved as $filename for the below processes to use.
Code:

(these are just two of 50 that all use the $filename variable)

mkdir -p /home/cmccabe/Desktop/NGS/API/$filename/{bam/{validation,coverage},bedtools,fastqc,hgmd,igv,panel/{reads,},panel/20x/{base,gene,percent},panel/{reads,},panel/30x/{base,gene,percent},pdf,picard,torrent,vcf/overall/{annovar,stats},vcf/panel/{annovar,}}

# create analysis log
echo "analysis done using v1.4 by $USER at $(date "+%D %r")" > /home/cmccabe/Desktop/NGS/API/$filename/analysis.txt

So basically store the portion in bold from the log in the filename variable so the other lines can use it to execute.
The problem is there could be multiple lines in the log, but only one returned from the bash. The line that is returned from the bash
needs to be matched to a line in log and stored as filename.

So in the log there may be 3 lines:
Code:

R_2017_01_13_12_11_56_user_S5-00580-24-Medexome, created on 2017-01-17+11:31:02.5035483130 and analysis done using v1.4 by cmccabe at 01/17/17 12:41:03 PM
R_2017_01_13_12_11_56_user_S5-00580-25-Medexome, created on 2017-01-17+11:31:02.5035483130 and analysis done using v1.4 by cmccabe at 01/17/17 1:22:09 PM
R_2017_01_13_12_11_56_user_S5-00580-26-Medexome, created on 2017-01-17+11:31:02.5035483130 and analysis done using v1.4 by cmccabe at 01/17/17 2:11:44 PM

But on 1 returned by the bash
Code:

R_2017_01_13_12_11_56_user_S5-00580-25-Medexome
So, R_2017_01_13_12_11_56_user_S5-00580-25-Medexome would be stored in the $filename variable.

I am really not sure how to do this and hope I posted enough information. Thank you :).

Read xml tags and then remove the tag using shell script

$
0
0
Code:

<Start>
<Header>
This is header section
</Header>
<Body>
<Body_start>
This is body section
<a>
<b>
<c>
<st>111</st>
</c>
<d>
<st>blank</st>
</d>
</b>
</a>
</Body_start>
<Body_section>
This is body section
<a>
<b>
<c>
<st>5</st>
</c>
<d>
<st>666</st>
</d>
</b>
<b>
<c>
<st>154</st>
</c>
<d>
<st>1457954</st>
</d>
</b>
<b>
<c>
<st>845034</st>
</c>
<d>
<st>blank</st>
</d>
</b>
</a>
</Body_section>
</body>
</start>

If 'st' value of 'c' tag is 154 , then the whole <b>to </b> tag needs to removed.Value 154 may or not be present in the file.
If the value 154 present , then the removal of the following part is needed
Code:

<b>
<c>
<st>154</st>
</c>
<d>
<st>1457954</st>
</d>
</b>

I want to do the coding in shell script. I can not use xslt because my system does not support xslt.

Error copying file using wildcard

$
0
0
Hi,

Code:

cd /web/myf
ls -ltr
-rwxr-x--- 1 user1 Admin    17 Oct  7 15:53 mykey.db
-rwxr-x--- 1 user1 Admin    21 Oct  7 15:53 test.sh

more test.sh
Code:

cd log01
pwd
cp ../*.db .

When i run the test.sh i get the below output / error.

Output:
Code:

/web/myf/log01
cp: cannot stat `../*.db': No such file or directory

I was expecting /web/myf/mykey.db to be copied to /web/myf/log01/mykey.db

Can you please tell me whats wrong with my code ?

Print asterisk instead of password (Bash)

$
0
0
OS : RHEL 6.5
Shell : Bash

With the following bash shell script, when I enter password, it won't be printed in the screen.
But, I would like Asterisk character to be printed instead of the real characters. Any idea how ?

Code:

$ cat pass.sh
echo "Enter the username"
read username

echo "Enter password"
stty -echo
read password
stty echo



Executing :

Code:

$ ./pass.sh
Enter the username
apuser
Enter password
$

How to append the multiple Delimiters up to requirement?

$
0
0
HI All,

How to append the multiple delimiters to at end the file up to 69 fields.
FinalDelimiter Count is 69
recrod Delimeter count is 10
so 69-10=59
this script will add upto 59 Delimiters to that records.

this script will check each and every record in a file and append the delimiters to the each and every record.
Input:
Code:

GBP|Company|Claims|N|728561|QIEL_UK|AL31DN-FLT15A|Carpenters Solicitors|17/11/16|269.99|
Output:
Code:

GBP|Company|Claims|N|728561|QIEL_UK|AL31DN-FLT15A|Carpenters Solicitors|17/11/16|269.99||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Thanks In advance
Vinod


Moderator's Comments:
Please use CODE tags as required by forum rules!

And, seriously, select an adequate forum to post in! Moved thread to "UNIX for Beginners Questions & Answers"

Help with sum range of data set together

$
0
0
Input File:
Code:

2000    3
1998    2
1997    2
1994    1
1991    1
1989    1
1987    2
1986    2
1985    1
1984    1
.
.
10      277256
9      278274
8      282507
7      284837
6      287066
5      292967
4      314583
3      342942
2      441704
1      487042

Desired Output
Code:

2000 110
1900 163
1800 139
.
.
.
200 3557341
100 13454579

Code Try:
Code:

awk '$1>=1901&&$1<=2000{total = total + $2}END{print total}' Input_File
110
awk '$1>=1801&&$1<=1900{total = total + $2}END{print total}' Input_File
163
awk '$1>=1701&&$1<=1800{total = total + $2}END{print total}' Input_File
139
awk '$1>=101&&$1<=200{total = total + $2}END{print total}' Input_File
3557341
awk '$1>=1&&$1<=100{total = total + $2}END{print total}' Input_File
13454579

I plan to sum the column 2 if column 1 is within every 100 group.
eg.
Sum all the column 2 value if column 1 is range within 1 to 100;
Sum all the column 2 value if column 1 is range within 101 to 200;
Sum all the column 2 value if column 1 is range within 201 to 300;

Desired output should have 20 line which column 1 is every 100 and sum its corresponding column 2 data (maximum record in data set is 2000).
The command I try is quite tedious as I need to type the command one by one from 1 to 100 till 1901 to 2000 and sum its corresponding column 2 data.

Thanks for any advice.

Help fixing awk code

$
0
0
can someone please help me spot and fix the issue with the following code:

Code:

awk -F, -v SEARCHPATT="(Wed|Tue)" -v ADDISTR="Mon|Tue|Wed|Thu|Fri|Sat|Sun" -vVF="$VALFOUND"
"BEGIN{          {D[10] = D[13] = 1
                D[11] = D[14] = 2
                }

$0 ~ "," VF "," {L = 1                                  # start output only if VALFOUND is matched
                }

!L              {next                                  # skip line if NOT VALFOUND
                }

                {A = strftime("%a %b %d %T %Y,%s",$3)
                }

A ~ SEARCHPATT &&
NF in D        {TOT = 0
                for (n = split ($(NF-D[NF]), T, "="); n>1; n--)    {sub (/_.*/, _, T[n]); TOT += T[n]}

                if (NF == 11 || A ~ ADDISTR)  print TOT "-" $3 "_" $(NF-D[NF]+1) "----" A
                }
}" datafile.txt

it's supposed to be a optimized, better version of the following code which i slapped together:

Code:

gawk -v SEARCHPATT="${SEARCHPATT}" -v ADDISTR="${INCEXCSTR}" -F, '/,'"${VALFOUND}"',/,0 {A=strftime("%a %b %d %T %Y,%s",$3);if((NF == 13) && (A ~ ADDISTR) && (A ~ SEARCHPATT)) {print $12"-"$3"_0""-" $13"----"A} else if ((NF == 14) && (A ~ ADDISTR) && (A ~ SEARCHPATT)) {print $12"-"$3"_0""-" $13"----"A} else if ((NF == 10) && (A ~ ADDISTR) && (A ~ SEARCHPATT)) {print $9"-"$3"_"$10"----"A} else if ((NF == 11) && (A ~ SEARCHPATT)) {print $9"-"$3"_"$10"----"A} }' datafile.txt | awk -F"----" '{print $1}'
the content of the datafile being read here could look like this:

typeA
Code:

0,greenscreen_pc10,1484711626,335086,/PROD/NOA/cicsmrch/sys/unikixmain.log,25M,greenscreen_pc10,25638056,0,333183--335086,-1
0,greenscreen_pc10,1484711922,337099,/PROD/NOA/cicsmrch/sys/unikixmain.log,25M,greenscreen_pc10,25796338,0,335086--337099,0
0,greenscreen_pc10,1484712222,338253,/PROD/NOA/cicsmrch/sys/unikixmain.log,25M,greenscreen_pc10,25887414,0,337099--338253,2

or like this:

typeB
Code:

0,plm_tomcat_logcheck,1484756597,12685,/opt/apps/plm/logs/catalina.out,964K,plm_tomcat_logcheck,985770,Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=0_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=0_nThe_file_or_directory_is_corrupted_and_unreadable=0_n,11713--12685,2
0,plm_tomcat_logcheck,1484756898,12865,/opt/apps/plm/logs/catalina.out,980K,plm_tomcat_logcheck,999773,Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=0_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=0_nThe_file_or_directory_is_corrupted_and_unreadable=0_n,12685--12865,8
0,plm_tomcat_logcheck,1484757197,13076,/opt/apps/plm/logs/catalina.out,996K,plm_tomcat_logcheck,1017418,Master_Item_Service_is_down=0_njava_lang_NoClassDefFoundError=0_njava_lang_OutOfMemoryError=0_nemxCommonAppInitialization__Error_while_initializing=0_nINFO__Stopping_Coyote_HTTP_1_1_on_http_8080=0_nThe_file_or_directory_is_corrupted_and_unreadable=0_n,12865--13076,0

or like this:

typeC
Code:

0,plm_tomcat_logcheck,1424392034,81033,/opt/apps/plm/logs/catalina.out,6.3M,plm_tomcat_logcheck,6539198,Master_Item_Service_is_down=0 java_lang_NoClassDefFoundError=0 java_lang_OutOfMemoryError=0 emxCommonAppInitialization__Error_while_initializing=0 INFO__Stopping_Coyote_HTTP_1_1_on_http_8080=0 The_file_or_directory_is_corrupted_and_unreadable=0,80801--81033
0,plm_tomcat_logcheck,1424392334,81307,/opt/apps/plm/logs/catalina.out,6.3M,plm_tomcat_logcheck,6561051,Master_Item_Service_is_down=0 java_lang_NoClassDefFoundError=0 java_lang_OutOfMemoryError=0 emxCommonAppInitialization__Error_while_initializing=0 INFO__Stopping_Coyote_HTTP_1_1_on_http_8080=0 The_file_or_directory_is_corrupted_and_unreadable=0,81033--81307
0,plm_tomcat_logcheck,1424392634,81367,/opt/apps/plm/logs/catalina.out,6.3M,plm_tomcat_logcheck,6565967,Master_Item_Service_is_down=0 java_lang_NoClassDefFoundError=0 java_lang_OutOfMemoryError=0 emxCommonAppInitialization__Error_while_initializing=0 INFO__Stopping_Coyote_HTTP_1_1_on_http_8080=0 The_file_or_directory_is_corrupted_and_unreadable=0,81307--81367

in the case of typeB and typeC, notice field 9 does not just contain a number. it contains a string and a 'equal-to' number. what i want to do is account for scenarios of typeA, typeB and typeC. meaning, add up the numbers in field 9, so that the resulting output looks similar to this:

Code:

0-1424534260_8--8
0-1424534560_8--8
0-1424534860_8--8
0-1413868231_12043--12043

User can't "su -" to root

$
0
0
Hello.

I have a RHEL 7.2 where a regular user can't make a "su -" to reach root account:
Code:

server532:t711740:/$ id
uid=75456(t711740) gid=10000(personales) groups=10000(personales),10(wheel)

tehrh532:t711740:/$ su -
Password:
su: Permission denied

But can make "sudo su -"
Code:

server532:t711740:/$ sudo su -
[sudo] password for t711740:

server532:root:/root# id
uid=0(root) gid=0(root) groups=0(root),70000(emergencia)

What could be the problem? Any idea?
Code:

server532:root:/root# grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash

server532:root:/root# cat /etc/securetty
console
vc/1
vc/2
vc/3
vc/4
vc/5
vc/6
tty0
tty1
tty2
tty3
tty4
tty5
tty6

server532:root:/root# cat /etc/pam.d/su
#%PAM-1.0
auth            sufficient      pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth          sufficient      pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth            required        pam_wheel.so group=wheel root_only use_uid
auth            include        system-auth-su
account        sufficient      pam_succeed_if.so uid = 0 use_uid quiet
account        include        system-auth
password        include        system-auth
session        optional        pam_mkhomedir.so skel=/etc/skel/ umask=0022
session        include        system-auth
session        optional        pam_xauth.so

server532:root:/root# ls -l /bin/su
-rwsr-xr-x. 1 root root 32072 Aug 21  2015 /bin/su


Bash script: problem with a function which use colors

$
0
0
Hello guys :)

I've a some issue with a function which use the bash colors in my script.
An example :
Code:

#!/bin/bash

set -x

log_in(){   
    host="srv1"
    remote_files="log/"
    LOG_FILE="logfile"

    green='\033[0;32m'
    red='\033[0;31m'
    none='\033[0m'

    if [[ $1 = "red" ]]; then
    color_in_red=("${red}"$2"${none}")
        echo -e "$color_in_red"
        echo -e "$(date)" "$2" >> "${LOG_FILE}"
    elif [[ $1 = "green" ]]; then
    color_in_green=("${green}"$2"${none}")
        echo -e "$(date)" "$2" >> "${LOG_FILE}"
        echo -e "$color_in_green"
fi
}
log_in red ""$host" The read right is missing on \""$remote_files"\""

The problem is it write good in the logfile but in output it stop write from the first variable, I should be more clear with the output that I had :
Code:

rsync_user@vmtest1:/home/scripts/test$ ./test.sh
+ host=srv1
+ remote_files=log/
+ LOG_FILE=logfile
+ log_in green 'srv1 The read right is missing on "log/"'
+ green='\033[0;32m'
+ red='\033[0;31m'
+ none='\033[0m'
+ [[ green = \r\e\d ]]
+ [[ green = \g\r\e\e\n ]]
+ color_in_green=("${green}"$2"${none}")
++ date
+ echo -e 'Wed Jan 18 17:33:16 CET 2017' 'srv1 The read right is missing on "log/"'
+ echo -e '\033[0;32msrv1'
srv1
rsync_user@vmtest1:/home/scripts/test$

And in the logfile, it works :
Code:

rsync_user@vmtest1:/home/scripts/test$ cat logfile
Wed Jan 18 17:33:16 CET 2017 srv1 The read right is missing on "log/"

Then, all in my console become red or green.. until I type "ll" maybe another commands..

If someone can help me, I would appreciate. :b:

How can i sort this listing in PYTHON by folder creation?

$
0
0
Is there anything i can do about this code? I need to sort it by folder creation, the newest will be first ... thx :)

Code:

for dirname in postme:

                                      dirname = os.path.abspath(dirname)

                                      if dirname:

                                          self._gal_files(os.path.basename(dirname), os.listdir(dirname), basepath=dirname)

scp files

$
0
0
Need assistance

I have ssh keys exchanged between servers for user ZID

ssh works without password between ZID . "ssh SERVER A to SERVER B works"

I have a property file on SERVER A which is owned by root and I need to transfer the file changing into ZID user and transfer to SERVER B

wanted to automate using a script . Need inputs on how I can accomplish this task .

LDAP Client not connecting to LDAP server

$
0
0
I have very limited knowledge on LDAP configuration and have been trying fix one issue, but unsuccessful.
The server, I am working on, is Solaris-10 zone. sudoers is configured on LDAP (its not on local server). I have access to login directly on server with root, but somehow sudo is not working for any user. I did restart service with "svcadm restart svc:/network/ldap/client:default" but no luck.
Code:

[ greog@sms-prod-sim2:/ ]
$ /usr/local/bin/sudo su -
sudo: ldap_sasl_bind_s(): Can't contact LDAP server
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
[ greog@sms-prod-sim2:/ ]

From /var/adm/messages --
Code:

Jan 19 00:16:50 sms-prod-sim2 ldap_cachemgr[9663]: [ID 293258 daemon.error] libsldap: Status: 1  Mesg: Can't connect to the LDAP server
Jan 19 00:16:50 sms-prod-sim2 ldap_cachemgr[9663]: [ID 293258 daemon.error] libsldap: Status: 1  Mesg: Timed out
Jan 19 00:17:01 sms-prod-sim2 ldap_cachemgr[9663]: [ID 293258 daemon.warning] libsldap: Status: 91  Mesg: openConnection: simple bind failed - Can't connect to the LDAP server
Jan 19 00:17:01 sms-prod-sim2 ldap_cachemgr[9663]: [ID 545954 daemon.error] libsldap: makeConnection: failed to open connection to ngsic-pre-ppt.com
Jan 19 00:17:01 sms-prod-sim2 ldap_cachemgr[9663]: [ID 545954 daemon.error] libsldap: makeConnection: failed to open connection to ngsic-pre-ppt.com
Jan 19 00:17:01 sms-prod-sim2 ldap_cachemgr[9663]: [ID 687686 daemon.warning] libsldap: Falling back to anonymous, non-SSL mode for __ns_ldap_getRootDSE. openConnection: simple bind failed - Can't connect to the LDAP server

Any alternative for mmin or cmin parameter

$
0
0
Hi,

I need to write a shell script where I need to check whether log file is generated in last 1 hour or not. But I am getting below error in using mmin or cmin parameter with find command:

Code:

find: bad option -mmin
find: bad option -cmin

So my concern is that any alternative for mmin option is there which I can use?

Any help will be greatly appereciated.

Thanks in advance.
Moderator's Comments:
Please use CODE tags when displaying sample input, sample output, and code segments.

Separating output after final character

$
0
0
I'm trying to write a script that will email the contents of my Application folder to me.

Code:

cd /Applications
ListApps=$(ls)
echo $ListApps | mail -s "Application Check" myself@myemail.com

This sends it in a paragraphed block i.e:
Code:

Adobe Acrobat Reader.app App Store.app Atom.app
Calculator.app Calendar.app

Is it possible to look for the final character for each string and put it onto a new line? i.e.
Code:

Adobe Acrobat Reader.app
App Store.app
Atom.app

I'd like to avoid specifically targeting the .app because I have a couple of directories in my Applications directory.

Issue splitting file based on XML tags

$
0
0
more a-d.txt1
Code:

<a-dets>
<a-serv>
<aserv>mymac14,mymac15:MYAPP:mydom:/web/domain/mydom/config
<NMGR>:MYAPP:/web/bea_apps/perf/NMGR/NMGR1034
<a-rep-string>
11.12.10.01=192.10.00.26
10.20.18.10=192.10.00.27
</a-rep-string>
</a-serv>
<w-serv>
<wserv>mywmac3,mywmac4:MYAPP:dev.MYAPP01.mycomp.com:/web/apache/2.4.10/https-MYAPP01/conf
<web-replace-string>
</web-replace-string>
</w-serv>
</a-dets>

I need to save the contents of first occurrence of <a-dets></a-dets> in app1.tmp and the next occurrence if found in the app2.tmp and so on.

It used to work on my previous Operating System using the below command.

Code:

awk '/<a-dets>/{A=1;++i} A{print >> ("app"i".tmp")} /<\/a-dets>/{A=0} ' a-d.txt1
But it does not work on my current OS i.e Linux mymac 2.6.18-416.el5 #1 SMP Wed Oct 26 12:04:18 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Question:

1. Can you please help explain what went wrong and why is the awk not extracting the data between the tags ? Is that acceptable or fault in the command ?

2. Can i use sed instead of awk to achieve the same as awk has too many flavors to deal with and i want this to run on most OS.

Inaccurate scanning of Bash array elements

$
0
0
Code:

username=cogiz
#!/bin/bash

shuffle() #@ USAGE: shuffle
{ #@ TODO: add options for multiple or partial decks
 Deck=$(
  printf "%s\n" {2,3,4,5,6,7,8,9,T,J,Q,K,A}{H,S,D,C} |
    awk '## Seed the random number generator
        BEGIN { srand() }

        ## Put a random number in front of each line
        { printf "%.0f\t%s\n", rand() * 99999, $0 }
    ' |
    sort -n |  ## Sort the lines numerically
      cut -f2  ## Remove the random numbers
  )
}

_deal() #@ USAGE: _deal [N] -- where N is no. of cards; defaults to 1
{      #@ RESULT: stored in $_DEAL
    local num=${1:-1}
    set -- $Deck
    _DEAL=${@:1:$num}
    shift "$num"
    cards_remaining=$#
    Deck=$*
}

deal() #@ USAGE: deal [N]
{      #@ RESULT: cards printed one to a line
    _deal "$@"
    printf "%s " $_DEAL
}

################################################

shuffle
declare -a PH
deal 8 > /home/cogiz/playerhand.txt          #  (7D 3H 4D 9H KC 2H 7C 9S)
deal 8 > /home/cogiz/computerhand.txt
deal 1 > /home/cogiz/activecard.txt            # (9C)
mapfile -t PH < /home/cogiz/playerhand.txt
X=$(</home/cogiz/activecard.txt)
A=( "${X[@]::1}" )                              # 9
B=( "${X[@]:1}" )                                # C
C=8                                                    # 8

for e in ${PH[@]}; do
 
  if [[ $e =~ $A|$B|8 ]]; then
      printf "$e " >> /home/cogiz/choices.txt
  else
      printf "0 " >> /home/cogiz/choices.txt
  fi
done

The above script is a rewrite of a terminal game of crazy 8's in Bash that I have been working on. The problem I am having is that the output file (choices.txt) is not showing me all of the results that it should. when the above script was run, the output in the choices.txt file was ( 0 0 0 9H 0 0 0 9S ).

It should have been ( 0 0 0 9H KC 0 7C 9S ).

Each time I run this script ( ./crazy.sh ) it gives me a different answer but always an incomplete one.

Can anyone explain to me why this is happening? I have been racking my brain for days trying to figure this out. Why does it show some valid card choices but not all? What am I missing?

Thank you in advance for any and all suggestions and advice.

Cogiz

File formating with lines

$
0
0
Hi All,

Need to modify a file basically join the extra line to one I am having a file like below

Quote:

A10
Records of transfer
File received
X,X,X,X,1,1,1,0,A.10,B.10,C.10,D.10,E.10,
F.10
X,X,X,X,1,1,1,0,A.11,B.11,C.11,D.11,E.11,
F.11
X,X,X,X,1,1,1,0,A.12,B.13,C.14,D.14,E.14,
F.14
And would like to make it as below .


Quote:

A10
Records of transfer
File received
X,X,X,X,1,1,1,0,A.10,B.10,C.10,D.10,E.10,F.10
X,X,X,X,1,1,1,0,A.11,B.11,C.11,D.11,E.11,F.11
X,X,X,X,1,1,1,0,A.12,B.12,C.12,D.12,E.12,F.12

Only root could login Redhat and could not su other user

$
0
0
Anyone has met the error following
1. Only root could login Redhat
2. Trying su another user by root, the error will be
su: warning: cannot change directory to /home/user: permission denied
su: /bin/bash: permission denied
3.I have checked the permission of the folder given and even change it to 777 and the error still exists.

Alias not working

$
0
0
I have several shell scripts which contain the nawk command.

Here is what i m doing assign the correct value to nawk as nawk is not found on a new systems.

Here is what i did.

more test.sh
Code:

[[ -x /usr/bin/gawk ]] && alias nawk=/usr/bin/gawk
[[ -x /usr/bin/nawk ]] && alias nawk=/usr/bin/nawk
[[ -x /usr/bin/awk ]] && alias nawk=/usr/bin/awk
nawk

Failed Output:
Code:

bash -x ./test.sh
+ source dr.profile
++ [[ -x /usr/bin/gawk ]]
++ alias awk=/usr/bin/gawk
++ [[ -x /usr/bin/nawk ]]
++ [[ -x /usr/bin/awk ]]
++ alias nawk=/usr/bin/awk
++ nawk
dr.profile: line 4: nawk: command not found

./test.sh: line 4: nawk: command not found

I was expecting nawk to become /usr/bin/awk
Can you suggest what is wrong ?

(VS 2008) New build config looking files from other folder build config

$
0
0
Hi Team,

My new build configuration always looking for the files from the build where i copied from.
please help me to resolve this.

I am using Visual studio 2008.It has Qt 4.8. plugins,qml,C++ development

I created new debug_new build configuration with additional preprocessor from the debug config.
I created new release_new build configuration by including additional preprocessor from the release config.

when i build with the config debug_new , it is looking for moc_xx.cpp file from the debug folder instead debug_new

Though the files are available in the build config moc direcotry , i get the error as cannot open source file. "No such file or directory".


The same issue is for release also.

Regards,
SenthilAndavan
Viewing all 16232 articles
Browse latest View live