shell


How can I write in 2nd column keeping the previous column is empty of a file in shell/awk? [duplicate]


Possible Duplicate:
How can I write in nth column of a file in awk?
For example:
abc
xyz
123
546
input.txt:
asdad
asdad
adghf
dfytr
output.txt:
asdad
asdad
adghf
dfytr
abc
xyz
123
546
Strange strange request. How about you tell us what you want, we are not going to steal your ideas, or maybe we will..
But presuming example text is in a text file how about
(cat input.txt; cat example.txt | awk '{ print " "$0}') > output.txt
In your example I would do:
cat input.txt | awk '{ print $0" abc xyz 123 546" }' > output.txt

Related Links

Weird C-shell return code for evaluating 1-1
hadoop.sh cannot locate/access TEZ jars: No such file or directory error
Redirecting file descriptors
Extract words from a List in C Shell
What is the function of shell
tmux with C-shell (tcsh) alias are lost
Chaining 4 unix commands together and breaking the command to additional lines
Redirecting stderr
cat: not found when I execute ksh script
My command prompt terminal won't change?
Cygwin can't execute shell script
Reading from kshell output in same file
Can OpenSSL verify software integrity as GPG does?
Why doesn't the shell command find . -name “*.txt” | rm remove all .txt files in the current directory?
to find the size of a file and assign it to a variable in UNIX script
How can I start in command mode (not insert mode) in readline's vi editting-mode

Categories

HOME
android
shell
sonarqube
django
embedded
phantom-dsl
search
static-site
yandex
nsbundle
polling
google-admin-sdk
32bit-64bit
startup
pybossa
libusb
http-post
google-data-studio
database-connection
replication
guzzle
rubymotion
inno-download-plugin
pimcore
zxing
windows-server-2003
interbase
fractions
user-defined-functions
iis-express
sqsh
kudu
hibernate-validator
memory-address
sharding
least-squares
imx6
google-data-api
mongoose-schema
chef-solo
mcustomscrollbar
vmware-fusion
datacachefactory
oracle-service-bus
stylecop
opencmis
mongotemplate
carrot2
edit
css-transforms
objectscript
mathcad
redistributable
pacemaker
resourcemanager
signalr.client
beamer
php-socket
spreadjs
dbamp
pushbots
grass
highland.js
sapi
assertion
dynatree
google-books
mod-proxy
viola-jones
uncompress
dulwich
dronekit-android
baasbox
nutiteq
typeconverter
entity-framework-4.3
umlgraph
beatsmusic
strawberry-perl
angular-carousel
template-deduction
cuba
rcaller
radiant
clickbank
gwt-openlayers
light
mysql-error-1044
hidapi
nebula
joomla-template
wp7test
chart-director
alice
listitem
objectquery
predicatebuilder
catransform3d
appledoc
ajax-polling
duplex
mathematical-notation
int64
business-model

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App