No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
11 Posted Topics
Hello, always mindboggled to see what handy options or builtins are there... Making it portable back to let's say Version 7 awk comes into mind: <code> awk 'BEGIN{ printf("%s\n", strftime("%Y%m%d", systime()-86400)) }' </code> Have fun, issue9
[code] echo -n "Welcome to `hostname`. What is your name? " read LINE echo -n "Hello ${LINE}, how are you? " read LINE if test "${LINE}" = "good" then echo "I'm glad to hear that." else echo "I'm sorry to hear that. Hope you feel better soon" fi echo "Good-bye." …
Hello Outkast, probably [url]http://unxutils.sourceforge.net[/url] could fit your needs... Cheers, issue9
Hello reham84, assuming paragraphs are separated by blank empty lines you might want to try this one: [code] awk 'BEGIN{ RS="" } { if(NR == 3){ printf("^L%s", $0) } }' fromfile >> anotherfile [/code] It should print a formfeed and the third paragraph from "fromfile" at the end of "anotherfile". …
Hello modesto916, could you please provide some more details? It is a little bit hard to figure out exactly what you are asking for. Well, just guessing, but as a starting point let me assume having a file with incomplete IP addresses in a file called "iplist": cat iplist [code] …
Probably the easiest way could be to pipe your file through grep(1). Assuming the file in question is named "YOURFILE" try cat YOURFILE | grep -v " " at your favorite shell prompt. Pls note the single blank between the double quotes.
You might want to try [code] awk 'BEGIN{ str="'"${STR}"'" }{ buf=$0; gsub(/ /, "", buf) } buf ~ str { print }' a.txt [/code] which should print the "matched" line untouched.
Please try [code] cat YOURFILE | sed 's/YOURSEARCH//g' > YOURFILE.tmp mv YOURFILE.tmp YOURFILE [/code] Just replace "YOURFILE" with the name of the file to search in and "YOURSEARCH" with the string you want to eliminate.
Please try [code] read HITTA; grep ${HITTA} nummer.txt [/code]
Hello srujanasadula, sorry for not providing a whole solution but here are some ideas: assuming the data to grep is in a file called "data" you might want to try this one [code] #!/bin/bash # # STR="yjava_jboss.log4j_file_appender_pattern_layout='%d .//- %x %-5p [%c] %m%n' " echo "-->${STR}<--" STR="`echo ${STR} |\ sed 's/\^/\\\^/ …
[code] #!/bin/bash # # cat 2.txt | while read LINE do BUF="`grep \`echo ${LINE} | awk '{ print $1 }'\` 1.txt`" if test $? -eq 0 then echo ${BUF} else echo ${LINE} fi done [/code]
The End.