Morgan Stanley

df|grep run|awk '{print $5}'|sed 's/%//g'

    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

Ø The $(...) Construct

   $ 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)" "^")

Ø The expr Command

     expr 1 + 2 #There is one space in 1,+, 2

     expr 10 + 20 / 2

     i=`expr $i + 1`



What is hashing?
What are some differences between linked lists and arrays?
What are the different types of JOINs in SQL?

A few questions on basic command-line syntax in Unix shells:
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)?

1. command >file 2>&1
2. cd dir; for i in *; do command; done
3. ps | grep processname or ps -C processname
#3 I disagree, more like ps aux |awk '$0 ~ /ProcessName/ && $0 !~ /awk/ {print $2}'

recursively renaming .c to .cpp files

列出当前文件夹中所有文件,包括子文件夹里面的:find .  或者 ls -la. 前者会列出子目录的内容.

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.


amazon-interview-questions1Answer

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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值