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

Formatting calendar in Linux Terminal
How to find which users logged in in the last 30 minutes UBUNTU 16.04
Fetch data from a file
Can I automate ssh connection? ssh user#server.company.com
Oozie— java: command not found - shell action
How to execute system command with an argument that contains spaces
Why the shell doesn't write the good hour and give me the year?
shell script with dynamic variable
Trying to get files from today date and result is displaying yesterday date files as well (Unix Korn Shell)
Nagios plugin that runs at 2pm daily
remove with double-asterisk wildcards does not work [duplicate]
Zero byte output File in Unix Environment
Format data using Awk Statemnt
Passing environment variables over ssh for remote expansion
Providing input for additional authentication using Plink
Way to create multiline comments in Bash?

Categories

HOME
grok
microsoftgraph
dns
google-spreadsheet
powerpoint
zend-framework
obfuscation
oracle-apex-5
can
yandex
babeljs
spring-session
banner
opengl-3
fosrestbundle
reactive-programming
automatic-ref-counting
shared-libraries
null-pointer
google-container-registry
babel
href
systemtime
strongname
fragment-backstack
outliers
fractions
wcag
openmdao
autodesk-designautomation
send
code-snippets
classcastexception
getpixel
numpy-broadcasting
typesafe-config
c9.io
kill
portforwarding
placeholder
term
sonarlint-eclipse
insight
amq
jqchart
django-1.10
bootstrap-tags-input
rmongo
visual-studio-2008-sp1
webjars
delta
udpclient
ascii-art
terracotta
avisynth
snackbar
node-serialport
java-security
document-repository
boost-program-options
device-tree
jjaql
dct
sbcl
xmltodict
breakout
oocss
mongohq
cnf
onload-event
swfobject
android-sdk-2.3
appjs
fitbounds
apache-commons-dbutils
procedures
cuteeditor
message-passing
application-verifier
sifr
echo3
feasibility
httpcookie

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