Posts
 
Reputation
Joined
Last Seen
Ranked #1K
Strength to Increase Rep
+7
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
18
Posts with Upvotes
15
Upvoting Members
7
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
6 Commented Posts
0 Endorsements
Ranked #977
~46.9K People Reached
Favorite Tags

152 Posted Topics

Member Avatar for Shane_Warne

[code] #!/bin/bash # we want to copy from path1 to path2 # step 1 make all the subdirectories find /path1 -type d | \ while read dir do mkdir /path2"${dir#/path1}" done # step 2 cp the files find /path1 -type f | \ while read $file do cp "$file" /path2"${file#/path1}" …

Member Avatar for davidchengnoc
2
3K
Member Avatar for gemni7

DOS network programming is not directly supported by TURBO C. If someone assigned this task to you then that person must have some linkable files to supply TCP/IP support. This stuff is VERY old. TURBO C should be banned from classrooms. IMO. There were some network support libraries here: [url]http://alumnus.caltech.edu/~dank/trumpet/[/url]

Member Avatar for dhanupatil
0
669
Member Avatar for Mayank Mathur
Member Avatar for sftranna
0
625
Member Avatar for sandip.bhoi

shell programming and C/C++ are not the same thing. maybe a moderator will move your post for you. Anyway, in shell there is no way without writing code (the ncurses library provides calls to do this) without resorting to C/C++ code. Plus you have to be in graphics mode.... see …

Member Avatar for dethrophes
0
202
Member Avatar for natnit

You will need 5 million different hash tables. Which meanns that if you are lokking for a given value, say -4, across all of your arrays you will have to consult each hash to see if -4 is in the array and which element it is. This will result in …

Member Avatar for Adak
-1
3K
Member Avatar for Asif_NSU

Have you tried running it in a debugger? If you do a stack dump (backtrace) it will show exactly where it bombed.

Member Avatar for blackcloudbd
0
631
Member Avatar for winbatch

Can I make a suggestion before you spend six months learning this on your own? It may save your spouse, children, and pets endless hours of anxiety watching you bash your head into a doorframe. :) Richard Stevens book 'Advanced Programming in the UNIX Environment' spends about 90 pages on …

Member Avatar for anurag.kyal
1
247
Member Avatar for captor

Sounds like a class asignment. try a here document [code] oldpw="$1" newpw="$2" passwd <<EOF "$1" "$2" "$2" EOF [/code]

Member Avatar for milanshentu
0
2K
Member Avatar for moroccanplaya

All of the UNIX OS is written and maintained in C - well some asm. GLIBC, all of the the Linux stuff as well. What was your sample size when you came to this conclusion?

Member Avatar for griswolf
0
361
Member Avatar for Iqbal_h_a

[code] cat /proc/meminfo [/code] shows the current state of memory. The format varies somewhat with Linux distributions. My version of Linux has what you want in the 4 th column on the second line. So, you will need to get the awk statement working for you. Then put it in …

Member Avatar for wsgeek
-1
454
Member Avatar for ashokkumarrsp

Are you talking about using NFA regexp in a DFA environment? Start with a DFA tool is the simple answer. There really is no code to convert from one to another, because it doesn't make much sense to do so. C and C++ have regexp libraries available for them. Pick …

Member Avatar for Nick Evan
0
2K
Member Avatar for SamY
Member Avatar for Pokeking
0
220
Member Avatar for Iam3R

You can pass the value to another function - and name the variable something else. But you are not gaining anything by doing that. [code] void refoo(int newname) { printf("variable newname=%d\n", newname); } void foo(void) { int oldname=13; printf(" variable oldname=%d\n", oldname); refoo(oldname); } [/code] As long the variable is …

Member Avatar for Iam3R
0
89
Member Avatar for ice_tea_lemon

C version: returns pi/4 [code] #include <stdlib.h> double pi_over_4(int n) { double iter=3; int eveodd=1; double pi=0.; for(pi=1.; n>0; n--, iter+=2., eveodd=!eveodd) { if(eveodd) pi-=1./iter; else pi+=1./iter; } return pi; } [/code]

Member Avatar for nekomata
0
170
Member Avatar for rinque

If you don't want the user to notice the script running: [code] nohup script.sh <parameters> 2>&1 > ./logfile & [/code] As long as your script does not ask for user input this will work. Otherwise you will have to resort to nohup and an expect script or nohup and a …

Member Avatar for rashshell
0
148
Member Avatar for srishekh

If you are in Unix: setitimer() and getitimer() have microsecond resolution on POSIX-compliant systems. Do you know about profiling and profilers?

Member Avatar for WaltP
0
597
Member Avatar for champ80

IF you're on unix: [code] sort -t ',' k- 1,1 -o newfile.csv oldfile.csv [/code] will sort the file the way you want - outside C++.

Member Avatar for emotionalone
0
586
Member Avatar for nihao

Choices 1. install GNU date (the linux version) so you can use the --date option. Also check the man page for your current version of date - it may be a GNU variant. 2. use C's strptime() function and strftime() function in a small C program 3. install the DATE …

Member Avatar for dklima
0
560
Member Avatar for modaslam

I have no idea why the original coder wrote that stuff, except it appears the s/he did not know about the standard C library date/time functions. date arithmetic is best done with that library - convert a date/time to a struct tm, convert the struct tm to epoch seconds. Do …

Member Avatar for modaslam
0
149
Member Avatar for tigrfire

the functions count_char and test_letter_content are from something else, but they provide: an example of changing case a way to compare the letter content of two char arrays I put a "main()" on the code so you can see how it works. You will have to find a way to …

Member Avatar for mprice
0
260
Member Avatar for nehamore

[QUOTE=nehamore;525444]hey thanks for ur help but can u please elaborate on this...what should i add to my code so that it works the way i want it to work?[/QUOTE] It sounds like you are coding UNIX. From the man page for system: [quote] If the return value of system() is …

Member Avatar for jim mcnamara
0
407
Member Avatar for dave_nithis

date -u causes UTC date/time to be displayed - FYI. If you format date like this: today=$(date +%Y%m%d) you get a value like 20080111, this is a number - an integer. When you split the input reformat it: newdate="$cyear$cmonth$cday" then compare integers: if [[ $today -ne $newdate ]] then echo …

Member Avatar for jim mcnamara
0
112
Member Avatar for Joncamp

FWIW - Oracle is as good as it gets on sorting. If the fields being sorted are indexed, you get maximum speed. We sort 200,000,000 records in 10-12 minutes - but that doesn't mean anything - performance is relative to the database schema and the available hardware. Sybase and DB2 …

Member Avatar for debasisdas
0
3K
Member Avatar for sandy_b76

[url]http://www.freebsd.org/cgi/man.cgi?query=sysexits&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html[/url]

Member Avatar for sandy_b76
0
169
Member Avatar for math_man

What narue meant - flags were set so the compiler put symbol names in the image file. When flags are set NOT to output symbols, then you get assembler.

Member Avatar for thekashyap
0
139
Member Avatar for pichels

Date arithmetic in shell is a pain. This link gives you several good scripts that do date compares and date arithmetic: [url]http://www.unix.com/showthread.php?t=13785[/url]

Member Avatar for dsmall
0
606
Member Avatar for stanats

Consider calling stat() to get the filesize first. Open the file, then move the file pointer forward to some arbitrary place. If you assume no last line is ever longer than say, 200 characters, then fseek() to within 200 character size units of the end of the file. fread in …

Member Avatar for echobase
0
2K
Member Avatar for mnmustafa
Member Avatar for jlb_2_99

Short answer would be to have a while loop controlled by the totalinsert and money variables [code] while( totalinsert < money) { /* ask for money here, add it to total insert */ } /* you get here when you have enough totalinsert */ [/code]

Member Avatar for jim mcnamara
0
150
Member Avatar for bergy_nj

[code] for i in $(cut -f 1,3 -d: /etc/passwd) do echo "${i#*:}" "${i%:*}" done [/code] This lets you see what is going on. [code]${i#*:}[/code] is parameter substitution- returns the value just before the colon - a number that is the user id. [code]${i%:*}[/code] returns the username, so: arr[number] = name …

Member Avatar for ghostdog74
0
123
Member Avatar for venuaccha

Do you mean 'will the compiler complain' - no. 'Is it a good idea' - Again, probably not. Reentrant functions should have all of their data passed to them as arguments, and not use global data structures. Semaphores are traffic cops for access to global objects or shared objects. This …

Member Avatar for venuaccha
0
201
Member Avatar for rusman

try: [code] #!/bin/ksh export infile=filename filedate() { perl -e ' use Time::Local; $mytime = timelocal(0,$ARGV[4],$ARGV[3],$ARGV[1], $ARGV[0] - 1,$ARGV[2] - 1900); print "$mytime\n"; ' $1 $2 $3 $4 $5 } compare() { keep="None found" maxallowed=$1 minallowed=$2 result=$minallowed while read record do echo "$record" | tr -s '/' ' ' | tr …

Member Avatar for jim mcnamara
0
154
Member Avatar for Raven11

Code caving creates a supplanting vector to user-controlled data sets, and is usually a game hacking technique, it's also used in exploits. Therefore, it's usually an asm code block. More than that is totally game-specific and platform-specific information that you'd only get at gaming cheat sites that had forums dedicated …

Member Avatar for jbennet
0
178
Member Avatar for mailsteam

I should have read this earlier. The answer is no. Unless you are using the Realtime Signal Extension - ie., "realtime signals". The real question is "Why are you doing this?" It's not like there aren't USR signals or realtime signals (lots of them) you can't use. No offense, but …

Member Avatar for mailsteam
0
132
Member Avatar for mforeman

If this is any version of unix: [code] grep -v "connected" filename > newfile[/code] deletes all of the lines having the word: connected

Member Avatar for winelover
0
228
Member Avatar for xgringo

You have to use either ksh (zsh) or bash to do this - ie., a modern shell with pattern matching. [code] cd /path/to/files find . -name '*.err' |\ while read file do tmp=${file%%.das*} mv $file "$file".das done [/code] Test it somewhere first!

Member Avatar for masijade
0
139
Member Avatar for yaeli_17

try: [code] # find $1 -type f -exec grep -l -e '/*' -e '//' {} \; | while read file do grep -q ';' $file if [[ $? -ne 0 ]] ; then echo $file | grep -q -e '\.c$' -e '\.h$' if [[ $? -ne 0 ]] ; then …

Member Avatar for jim mcnamara
0
112
Member Avatar for Mushy-pea

You need to use sed, and you have to learn about regular expressions. based on your data a very specific (not generalized) solution is: [code] $> echo "Here's some text and ~this bit gets removed~, where tilda is the delimiter." |read var $> echo $var Here's some text and ~this …

Member Avatar for kuom
0
108
Member Avatar for jorritgoddijn
Member Avatar for bucci

This will generate a report like you asked for. [code] nawk ' { shortcode[$11]=$11 causecode[$12]=$12 result[$11 $12]++ } END{ for( short in shortcode) { for(cause in causecode) { if(result[short cause]) { print short, "count", cause, result[short cause] } } } } ' filename [/code] You will have to write another …

Member Avatar for jim mcnamara
0
153
Member Avatar for amitc

It looks like you're trying to automate vi. There are such things as "ed scripts" - scripts that invoke the ed editor. You can use that scripting language easily. vi presents problems because it expects the terminal to be a tty, ed doesn't. Your stdin is a shell script. man …

Member Avatar for ghostdog74
0
122
Member Avatar for Iqbal_h_a
Member Avatar for Iqbal_h_a
0
306
Member Avatar for lastkey

[code] for i in vs01a vs01b do for k in 1 2 do rsh $i echo $(tail -20 /opt/oracle/admin/+ASM/bdump/alert_+ASM"$k".log) >> VS_logs.txt done done[/code] For "rsh" do you mean rexec or remsh? Or does rsh create a remote shell on remote systems using your OS?

Member Avatar for lastkey
0
123
Member Avatar for jackjill

script: [code] # $1 = path to examine # usage # myscript /path find "$1" -type d -print |\ while read file do permissions=$(ls -l $file | awk '{print $1}') echo "$permissions $file" done [/code]

Member Avatar for jim mcnamara
0
103
Member Avatar for jobra

UNIX only: [code] getenv("TZ"); [/code] will return the timezone setting. The result is in the form xxxNxxx, example MST7MDT. TZ has to be set for localtime() to return the correct time. MST is GMT +7. If TZ is not set the system is running GMT by default. Assuming time has …

Member Avatar for John A
0
233
Member Avatar for vicky_dev

But yiu have to put the integer values out ther in the file in such a way that you can guarantee a read, ie, put it on a separate line with demarcation so you can see it is not part of the list (in case you forgot to write it …

Member Avatar for Ancient Dragon
0
115
Member Avatar for verkiles

su or sudo Read the man page for su. Both of these require superuser (root) access.

Member Avatar for jim mcnamara
0
70
Member Avatar for rchadhaney

[code] file_name=`echo "$file_name" | sed 's/ //g'` [/code] That removes any spaces in the file_name variable

Member Avatar for rchadhaney
0
101
Member Avatar for crab68

Record truncation? Not normal behavior unless the record has embedded ascii nul characters. Lack of disk space or exceeding enabled quotas will also cause the output file to truncate. grep has a line length limit of 2048 characters. There also is a concept of largefiles, files which are so big …

Member Avatar for crab68
0
2K
Member Avatar for hillol

The short answer is "yes". If you give an example of the data then we can help you.

Member Avatar for jim mcnamara
0
239

The End.