sed [options] 'command' file(s)
sed [options] -f scriptfile file(s)
awk ' pattern {action} '
#!/usr/bin/ksh
#path=/home/edrea/1.txt
#path1=/home/edrea/2.txt
for i in /home/edrea/*.del
do
newfile=`echo $i | sed 's/\.del//g'`
echo $i
echo $newfile
mv $i $newfile
done
$ file=exec.o
$ lastchar=$(echo $file | sed 's/.*\(.\)$/\1/')
$ echo $lastchar
$ filename=/users/steve/memos
$ firstchar=$(echo $filename | cut -c1)
$ filename=$(echo $filename | tr "$firstchar" "^") #translate / to ^
$ filename=/users/steve/memos
$ filename=$(echo $filename | tr "$(echo $filename | cut -c1)" "^")
expr 1 + 2 #There is one space in 1,+, 2
expr 10 + 20 / 2
i=`expr $i + 1`
What is hashing?
1. How would you log output and error messages from a command to a file?
2. How would you run the same command on every file in a directory?
3. How would you find the PID of a named process (say if you wanted to kill it)?
2. cd dir; for i in *; do command; done
3. ps | grep processname or ps -C processname
DBMS questions:
- Join operations
- Normalisation with given tables
- What can be done for making select query more faster ? — expected answer was to use INDEX
- Some queries were asked with some tables given ..
Table CustomerOrder, columns customerid, orderid, orderdate.
Give a query for customers that placed orders today
Query to get the day in the last 30 days with the most orders
What is an index?
Why not add an index to all the columns?
What data structure to store index data?
Why a btree?
* Employees
o id
o name
o department_id
o start_date
o salary
* Departments
o id
o department
get max salary
get all names and dept
get dept that spends most on salary:
Write a program/script. to find a file in the current directory and sub-directories, tools like find and grep are missing.
In a particular directory, list the 15 recently modified files. ls -ltr | tail -15.
Replace a word "Old" with word "new" in all the files of the directory. Solution can be a linux script. also.
sed -i 's/Old/new/g' *.txt
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7899089/viewspace-734824/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7899089/viewspace-734824/