Hi,
I have a text file that looks like this:
abcbs,adbsd,,,,,,
adsdfd,afdsf,,,,,,
adfsd13,1232dfsfe,,,,,,
And I want to insert a string after the second comma that looks like this:
abcbs,adbsd,string,,,,,
adsdfd,afdsf,string,,,,,
adfsd13,1232dfsfe,string,,,,,
Thanks,
SP
Yes, it works but everything is printed it on the same line, which I don 't want it to be. I tried replace the print with printf /n and it did not work.
Please advise
SP
Thanks, it worked but it print everything on the same line.
I would like the output looks like this:
DN: user1,ou=testing,o=abc
Changetype: modify
Delete: l
l: loca
DN: user2,ou=testing,o=abc
Changetype: modify
Delete: l
l" locb
Thx,
Steve
All,
I need help adding newline using awk and this is what I have for the input file:
DN: user1,ou=testing,o=abc
Changetype: modify
l: loca
DN: user2,ou=testing,o=abc
Changetype: modify
l" locb
I ran this command and it did not work.
awk '{print}/^Changetype:/{print "Delete: l"'...
All,
I have a text file looks similar below:
DN: cn=user1,ou=admin,o=abc
changetype: add
l: loc1
HomeDirectory: FS1_vol0,ou=servers,o=abc
DN: cn=user2,ou=is,o=abc
l: loc2
messageserver: fs2
homedirectory: FS2_vol0,ou=servers,o=abc
.
.
.
I wanted to use awk to do this:
DN: same as below...
I got an error when I entered at the command prompt:
awk -v RS=" '{gsub(/\n +/,"");$1=$1;print}' test.txt >testt.txt
gawk: cmd. line:1: test.txt
gawk: cmd. line:1: ^ syntax error
It worked except I need to get rid of the space on certain lines.
Example:
Name: XXX Address: YYY City: ZZZ
Name: AAA Address: BBB City: CCCC CC
Name: AAA Address: BBB City: CCCCCC
Thx,
SP
I query the ldap server using the following command and noticed certain attributes that are longer than 80+ column end up wrap-around the next with a space indent. For example:
ndshomedirectory: fs1_vol0,ou=servers,o=amc#0#users/test
user1
Is there an option to prevent this or it is the...
All,
I tried to query the home directory in eDirectory and it did not work for me. Does anyone out did it with sucess?
ldapsearch -h ldapserver -D cn=admin,o=amc -w password -b o=amc "(&(objectclass=user)(ndshomedirectory=fs1_vol0,ou=servers,o=amc))" dn ndshomedirectory
Please advice,
SP
I had one issue with script if one or several entries in the input file looks like this:
Name: XXX
Address: yyy
City: ZZZ
Name: AAA
Address: BBB
City: CCC
CCC
Name: AAA
Address: BBB
City: CCC
CCC
How I modify this command
awk '
/^Name:/{n=$0}
/^Address:/{a=$0}
/^City:/{printf "%s %s...
I had one issue with script if one or several entries in the input file looks like this:
Name: XXX
Address: yyy
City: ZZZ
Name: AAA
Address: BBB
City: CCC
CCC
Name: AAA
Address: BBB
City: CCC
CCC
How I modify this command
awk '
/^Name:/{n=$0}
/^Address:/{a=$0}
/^City:/{printf "%s %s...
How do I reverse the format from
Name: XXX Address: YYY City: ZZZ
Name: AAA Address: BBB Citry: CCC
to
Name: XXX
Address: yyy
City: ZZZ
Name: AAA
Address: BBB
City: CCC
Thanks,
SP
I put the commands in the script file called awk.txt and type in awk -f awk.txt addr.txt and it error out.
awk.txt contains:
'/^Name:/{n=$0}
/^Address:/{a=$0}
/^City:/{printf "%s %s %s\n",n,a,$0;n=a=""}'
Please advice
Thanks,
SP
All,
I am new with AWK and want to learn how to manipulate a text file.
Here how the text file looks like before:
Name: XXX
Address: yyy
City: ZZZ
Name: AAA
Address: BBB
City: CCC
And it is how it looks like after:
Name: XXX Address: YYY City: ZZZ
Name: AAA Address: BBB Citry: CCC...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.