slutb3
1
I need to know how can I remove all word after comma on each line.
Like:
jjkj,iiuiui,ijlkjkij,ookoo
kijljlj,jhhkj,ijijkijkj,oijkijj
kjkljlkj,kjkjlkjlkj,opok,okop
to
jjkj,
kijljlj,
kjkljlkj,
Can you help me please?
Thanks!
try with below code
cat test.txt
jjkj,iiuiui,ijlkjkij,ookoo
kijljlj,jhhkj,ijijkijkj,oijkijj
kjkljlkj,kjkjlkjlkj,opok,okop
awk -F "," '{print $1","}' test.txt
Cheers
Harish
slutb3
3
Don't work
Do you have another command?
The above comment does not tell what really went wrong. Always try to post error/output you got, to get an idea.
Through Sed..
sed 's/,.*/,/' inputfile
slutb3
5
It work when I add > outputfil.txt after your command!!!
Thanksss
cant figure out where exactly you are getting error for below
awk -F "," '{print $1","}' test.txt
Output with above command
jjkj,
kijljlj,
kjkljlkj,
If you want you can direct it to some outputfile.txt like below
awk -F "," '{print $1","}' test.txt > outputfile.txt
Cheers
Harish